crelte / loadData / Globals
Interface: Globals
Globals is sort of a queue
each time a new request get's started a copy of globals is created which references some properties of the original one
then if everything is loaded th original globals is "overriden" with the new one and we get a new state
Methods
get()
get<T>(name): T | null;returns a globalValue
Note
This only works in loadData, in loadGlobalData this will throw an error. In that context you should use .getAsync
Type Parameters
T
T = any
Parameters
name
string
Returns
T | null
getAsync()
getAsync<T>(name): T | Promise<T | null> | null;Get a store which contains a globalSet and wait until it is loaded
Note
This is only useful in loadGlobalData in all other cases you can use .get which does not return a Promise
Type Parameters
T
T = any
Parameters
name
string
Returns
T | Promise<T | null> | null
getStore()
getStore<T>(name): Readable<T> | null;returns a store which contains a globalSet
Note
This only works in loadData, in loadGlobalData this will always return null. In that context you should use .getAsync
Type Parameters
T
T = any
Parameters
name
string
Returns
Readable<T> | null
set()
set<T>(name, data): void;can only be called in loadGlobalData contexts
Type Parameters
T
T
Parameters
name
string
data
T
Returns
void