Skip to main content

# IGlobal

The Global object allows for data to be shared between custom forms/tools/plugins within a user's session. Unlike the Session scripting object, where data is isolated to be visible/accessible only by the form/plugin that writes the variables, values written to the Global store are visible to all such customizations

The implementation of this object should write the global state data to the host application's sessionStore, but should ensure that the state is isolated away from the host application's state variables. This should be done by creating naming conventions for the global keyspaces, e.g. ssf.global.[key].

In order to ensure that guest applications cannot consume significant amounts of sessionStorage, restrictions should be placed on the number and size of the stored session state. In particular, we can start with these values: Each valueObj, when stringified, cannot exceed 5 KB Total global state should be limited to 50 values This will ensure that no guest can consume more than 250 KB of sessionStorage

See GlobalEvents for supported events

## Extends​

- `IScriptingObject`

## Methods​

### _dispose()?​

    optional _dispose(): void;

#### Returns​

`void`

#### Inherited from​

`IScriptingObject`.`_dispose`

### _toJSON()​

    _toJSON(): RemotingScriptingObject;

#### Returns​

`RemotingScriptingObject`

#### Inherited from​

`IScriptingObject`.`_toJSON`

### get()​

    get(key: string): Promise<string>;

get a value from the global store

#### Parameters​

##### key​

`string`

unique key to identify the value

#### Returns​

`Promise`<`string`>

value stored in the global store

### set()​

    set(
       key: string,
       value: unknown,
    overwrite?: boolean): Promise<void>;

set a value in the global store

#### Parameters​

##### key​

`string`

unique key to identify the value

##### value​

`unknown`

value to be stored

##### overwrite?​

`boolean`

if true, overwrite the value if it already exists. Default is false

#### Returns​

`Promise`<`void`>

## Properties​

### Change​

    readonly Change: IEvent;

event fired when the global state changes

Use GlobalChangeListener to handle this event

### id​

    readonly id: string;

#### Inherited from​

`IScriptingObject`.`id`

### objectType​

    readonly objectType: string;

#### Inherited from​

`IScriptingObject`.`objectType`