Files
DefinitelyTyped/types/cls-hooked/index.d.ts
Leo Liang 66e7e2e2da Add typings for cls-hooked (#20154)
* Add typings for cld-hooks

* Rename NameSpace to Namespace
2017-10-03 11:06:35 -07:00

26 lines
859 B
TypeScript

// Type definitions for cls-hooked 4.2
// Project: https://github.com/jeff-lewis/cls-hooked
// Definitions by: Leo Liang <https://github.com/aleung>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { EventEmitter } from 'events';
export interface Namespace {
active: any;
set<T>(key: string, value: T): T;
get(key: string): any;
run(fn: (...args: any[]) => void): void;
runAndReturn<T>(fn: (...args: any[]) => T): T;
bind<F extends Function>(fn: F, context?: any): F; // tslint:disable-line: ban-types
bindEmitter(emitter: EventEmitter): void;
createContext(): any;
}
export function createNamespace(name: string): Namespace;
export function getNamespace(name: string): Namespace;
export function destroyNamespace(name: string): void;
export function reset(): void;