apiref
stack-local-storage@0.2.0

ExclusiveStackLocalStorage.run()  Method

Runs a function with a given store.

Signature

run<X, A extends any[]>(store: T, f: (...args: A) => X, ...args: A): X;

Remarks

If the store is already set (i.e. if the run calls are nested), it will throw an error with the conflictErrorMessage as the message.

Parameters

ParameterTypeDescription
storeT

the local store

f(...args: A) => X

the function to run

argsA

the arguments to pass to the function

(Returns)X

- the return value of the function