1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import { EventEmitter } from 'events';
|
9 |
|
10 | export interface Namespace {
|
11 | active: any;
|
12 |
|
13 | set<T>(key: string, value: T): T;
|
14 | get(key: string): any;
|
15 | run(fn: (...args: any[]) => void): void;
|
16 | runAndReturn<T>(fn: (...args: any[]) => T): T;
|
17 | runPromise<T>(fn: (...args: any[]) => Promise<T>): Promise<T>;
|
18 | bind<F extends Function>(fn: F, context?: any): F; // tslint:disable-line: ban-types
|
19 | bindEmitter(emitter: EventEmitter): void;
|
20 | createContext(): any;
|
21 | enter(context: any): void;
|
22 | exit(context: any): void;
|
23 | }
|
24 |
|
25 | export function createNamespace(name: string): Namespace;
|
26 | export function getNamespace(name: string): Namespace | undefined;
|
27 | export function destroyNamespace(name: string): void;
|
28 | export function reset(): void;
|
29 |
|
\ | No newline at end of file |