Skip to main content

Class: SharedGlobal

Defined in: src/sdk/data/SharedGlobal.ts:52

Experimental

A utility class for working with shared global objects.

Shared global objects are objects that can be accessed from multiple CoherentGT views. Each shared global has an owning view - this is the view from which the global was originally created. When a view is destroyed, all globals that it owns are detached. Once a shared global is detached, it must be created again by another view to continue to be used. This API is still under development and should not be used for production code.

Constructors

Constructor

new SharedGlobal(): SharedGlobal

Experimental

Returns

SharedGlobal

Methods

await()

static await<T>(name): Promise<SharedGlobalObjectRef<T>>

Defined in: src/sdk/data/SharedGlobal.ts:111

Experimental

Waits for a shared global object to be attached.

Type Parameters

Type ParameterDefault type
T extends objectobject

Parameters

ParameterTypeDescription
namestringThe name of the shared global object for which to wait.

Returns

Promise<SharedGlobalObjectRef<T>>

A Promise which is fulfilled with a reference to the specified shared global object once the global has been created. This API is still under development and should not be used for production code.


get()

static get<T>(name): Promise<SharedGlobalObjectRef<T>>

Defined in: src/sdk/data/SharedGlobal.ts:79

Experimental

Gets a shared global object. If the shared global does not already exist, then it will be created with this view as the owner.

Type Parameters

Type ParameterDefault type
T extends objectobject

Parameters

ParameterTypeDescription
namestringThe name of the shared global object to get.

Returns

Promise<SharedGlobalObjectRef<T>>

A Promise which is fulfilled with a reference to the specified shared global object. This API is still under development and should not be used for production code.