ArcGISContextManager

Class

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
id number

Random identifier useful for debugging issues where race-conditions can result in multiple contexts getting created

Accessors

Accessor Type Notes
context IArcGISContext

Return a reference to the current state. When .setAuthentication() or .clearAuthenentication() are called, the state will be re-created. This is done so frameworks like React or Ember can detect changes.

Methods

Method Returns Notes
Promise<ArcGISContextManager>

Used to create a new instance of the ArcGISContext class.

const ctxMgr = await ArcGISContextManager.create();
void

Clear the Authentication (UserSession). This should be called when a user signs out of an application, but the application continues running

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

create

Static Static Class Method

Used to create a new instance of the ArcGISContext class.

Parameters

Parameter Type Default Notes
opts Optional IArcGISContextManagerOptions {}

Returns


const ctxMgr = await ArcGISContextManager.create();

clearAuthentication

Class Method

Clear the Authentication (UserSession). This should be called when a user signs out of an application, but the application continues running

  • clearAuthentication() : void

Returns

void

setAuthentication

Class Method

Set the Authentication (UserSession) for the context. This should be called when a user signs into a running application.

  • setAuthentication(auth: UserSession) : Promise<void>

Parameters

Parameter Type Default Notes
auth Required UserSession

Returns

Promise<void>

setProperties

Class Method

Set the properties hash and re-create the context

  • setProperties(properties: Record<stringany>) : void

Parameters

Parameter Type Default Notes
properties Required Record<stringany>

Returns

void

Class defined in common/src/ArcGISContextManager.ts:77