![]() |
Infohub JS API
|
Maintains the shared connection and selection state for COLNEO infohub services.
A context stores the authenticated user and access token, the service endpoints, and the currently selected scope, project, and optional coordination model. Pass the same context instance to service classes so that they use consistent authentication and project state.
Context extends EventTarget and dispatches a CustomEvent named contextChanged whenever one of its setters changes the stored state. The event's detail object contains only the values changed by that operation. Use the context getters when a complete view of the current state is required.
Public Member Functions | |
| constructor () | |
| dump () | |
| async | getCoordinationModel (query={ members:['info'] }) |
| getCoordinationModelShortId () | |
| async | getProject (query={ members:['info'] }) |
| getProjectShortId () | |
| getScope () | |
| getServiceUrl (servicename) | |
| getToken () | |
| getUserId () | |
| resetLocalStorage (cb) | |
| resetProjectAndScope () | |
| restoreFromLocalStorage (cb) | |
| saveToLocalStorage (cb) | |
| setCoordinationModelShortId (sid) | |
| setProjectShortId (sid) | |
| setScope (scope) | |
| setScopeAndProjectShortId (scope, project_sid, coordmodel_sid=null) | |
| setServiceUrls (cfg) | |
| setServiceUrlsDefault () | |
| setUserAndToken (userid, token) | |
Static Public Member Functions | |
| static | getServiceNames () |
Static Public Attributes | |
| static | SERVICE |
| constructor | ( | ) |
Create an COLNEO infohub context with service endpoints set to null and empty user state.
Example
| dump | ( | ) |
Print current context to the console (for debugging).
| async getCoordinationModel | ( | query = { members: ['info'] } | ) |
Get Coordination Model as Object
API call to get coordmodel data from infohub by short id.
| getCoordinationModelShortId | ( | ) |
| async getProject | ( | query = { members: ['info'] } | ) |
| getProjectShortId | ( | ) |
| getScope | ( | ) |
Get current scope ID.
|
static |
Get list of names of supported web services.
Example:
| getServiceUrl | ( | servicename | ) |
Get URL of supported webservice.
| {string} | servicename |
| getToken | ( | ) |
Get current access token.
| getUserId | ( | ) |
Get current user id.
| resetLocalStorage | ( | cb | ) |
| resetProjectAndScope | ( | ) |
Reset scope, project and coordinationmodel to null.
| restoreFromLocalStorage | ( | cb | ) |
| {Function} | cb |
| saveToLocalStorage | ( | cb | ) |
| {Function} | cb |
| setCoordinationModelShortId | ( | sid | ) |
Set current project short id.
| {string} | sid |
| setProjectShortId | ( | sid | ) |
Set current project short id.
| {string} | sid |
| setScope | ( | scope | ) |
Set current scope ID.
| {string} | scope |
| setScopeAndProjectShortId | ( | scope, | |
| project_sid, | |||
| coordmodel_sid = null ) |
Set scope, project short id and coordmodel shortid.
| {string} | scope |
| {string} | project_sid |
| {string|null} | coordmodel_sid |
| setServiceUrls | ( | cfg | ) |
Set multiple service URLs at once.
Example:
| {Record<string,string>} | cfg - Object mapping service names to URLs |
| {TypeError} | If cfg is not a non-null object |
| setServiceUrlsDefault | ( | ) |
Set default values for services urls.
| setUserAndToken | ( | userid, | |
| token ) |
Set current user id and authentication token.
| {string|null} | userid |
| {string|null} | token |
|
static |
Supported web services of COLNEO infohub.
HUB | CONFIG | USR | IDP | IAM | RENDER | RPC | TYPES | CM
Example: