ArcGISContextManager
The manager exposes context (IArcGISContext
), which combines a UserSession
with
the portal/self
and user/self
responses to provide a central lookup for platform
information, api urls, and other useful properties for developers such as IRequestOptions
IUserRequestOptions, IHubRequestOptions etc.
The context is exposed on gthe .context
property, and as the authentication changes
the .context
is re-created. This is done to allow web frameworks to watch for
changes on that single property, instead of having to leverage observers or events
for change detection.
Please see the ArcGISContext Guide for additional information.
Properties
Property | Type | Notes |
---|---|---|
number |
Random identifier useful for debugging issues where race-conditions can result in multiple contexts getting created |
Accessors
Accessor | Type | Notes |
---|---|---|
IArcGISContext |
Return a reference to the current state.
When |
Methods
Method | Returns | Notes |
---|---|---|
|
Promise<ArcGISContextManager> |
Used to create a new instance of the ArcGISContext class.
|
|
Promise<ArcGISContextManager> |
Create a new instance of the ArcGISContextManager from a serialized string. This is useful when you want to store the context in a browser's local storage or server side session. |
|
void |
Clear the Authentication (UserSession). This should be called when a user signs out of an application, but the application continues running |
|
string |
Serialize the context into a string that can be stored and re-hydrated |
|
Promise<void> |
Set the Authentication (UserSession) for the context. This should be called when a user signs into a running application. |
|
void |
Set the properties hash and re-create the context |
|
Promise<void> |
Update the User's Hub Settings
Stores in the user-app-resource associated with the |
create
StaticParameters
Parameter | Type | Default | Notes |
---|---|---|---|
opts Optional | IArcGISContextManagerOptions | {} |
Returns
const ctxMgr = await ArcGISContextManager.create();
deserialize
StaticCreate a new instance of the ArcGISContextManager from a serialized string. This is useful when you want to store the context in a browser's local storage or server side session.
Parameters
Returns
clearAuthentication
Clear the Authentication (UserSession). This should be called when a user signs out of an application, but the application continues running
Returns
setAuthentication
Set the Authentication (UserSession) for the context. This should be called when a user signs into a running application.
Parameters
Returns
updateUserHubSettings
Update the User's Hub Settings
Stores in the user-app-resource associated with the hubforarcgis
clientId
and updates the context
Parameters
Parameter | Type | Default | Notes |
---|---|---|---|
settings Required | IUserHubSettings |
Returns
Class defined in common/src/ArcGISContextManager.ts:165
Used to create a new instance of the ArcGISContext class.