StackLocalStorage Class
A StackLocalStorage can be used to pass (thread) values (referred to as a “store”) through synchronous call stacks. This can be helpful in eliminating repetitive variable passing when creating DSLs.
Signature
export declare class StackLocalStorage<T>
Example
const store = new StackLocalStorage(0)
store.run(1, () => {
console.log(store.getStore()) // 1
})
console.log(store.getStore()) // 0
Constructors
Constructor | Description |
---|---|
(constructor)(initialStore) | Creates a new StackLocalStorage. |