UNPKG

disposable-cls

Version:

Provides disposable continuation local storage for Node.js.

47 lines (46 loc) 1.36 kB
/** * Represents a context stack item that holds contextual data and associated items * in scope for the duration of an asynchronous invocation. */ export declare class ContextStackItem { private _data; private _parent; private _refCount; /** * Initializes a new context stack item. * * @param data An object that will be held in scope. * @param parent The parent context stack item. */ constructor(data: Object, parent: ContextStackItem); /** * Gets the context data for the current context stack item. * * @returns An object that contains the context data for the current context stack item. */ data: Object; /** * Gets the parent context stack item. * * @returns A context stack item that is the parent of the current. */ parent: ContextStackItem; /** * Gets the reference count of the current context stack item. * * @returns The current reference count. */ refCount: number; /** * Adds a reference to the current context stack item. * * @returns The current reference count. */ addRef(): number; /** * Releases a reference from the current context stack item. * * @returns The current reference count. */ release(): number; }