-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
34 lines (33 loc) · 1.17 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
declare namespace contextor {
interface Contextor {
/**
* Create a new context.
* @returns {self}
*/
create: () => this;
/**
* Set a value in the current context.
* @param {string} key - The identifier key.
* @param {*} value - The value.
* @throws {ReferenceError} On missing current context.
*/
set: (key: string, value: any) => this;
/**
* Get a value in the current context.
* @param {string} key - The identifier key.
* @param {*} defaultValue - The default value to return in case.
* @param {boolean} allowUndefinedContext - Whether or not to allow undefined context.
* @returns {*} The value or default value for missing key.
* @throws {ReferenceError} On missing value for given key in current context.
*/
get: (key: string, defaultValue: any, allowUndefinedContext?: boolean) => any;
/**
* Get an object describing memory usage of the contextor and process
* in order to help debugging potential memory leaks.
* @returns {object} Memory usage description.
*/
getMemoryUsage: () => object;
}
}
declare const contextor: contextor.Contextor;
export = contextor;