UNPKG

disposable-cls

Version:

Provides disposable continuation local storage for Node.js.

22 lines (21 loc) 955 B
/** * Creates scope that will be preserved for the lifetime of the supplied asynchronous invocations. * * @param contextItems An array of objects that will be scoped. * @param asyncFunction The root asynchronous function for which scope is to be preserved. */ export declare function using(contextItems: Object[], asyncFunction: Function): void; /** * Retrieves an object from the current scope. * * @param objectType A constructor function representing the type of object that should be returned. * @returns An object from the current scope that is of the supplied type; or 'undefined' if no * object of that type could be found in the current scope. */ export declare function getCurrentObject(objectType: Function): Object; /** * Bind an EventEmitter to the currently active context stack. * * @param emitter The EventEmitter to bind. */ export declare function bindEventEmitter(emitter: NodeJS.EventEmitter): void;