-
Notifications
You must be signed in to change notification settings - Fork 640
/
livelinessChecking.ts
49 lines (44 loc) · 1.46 KB
/
livelinessChecking.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Defines what MST should do when running into reads / writes to objects that have died.
* - `"warn"`: Print a warning (default).
* - `"error"`: Throw an exception.
* - "`ignore`": Do nothing.
*/
export type LivelinessMode = "warn" | "error" | "ignore"
let livelinessChecking: LivelinessMode = "warn"
/**
* Defines what MST should do when running into reads / writes to objects that have died.
* By default it will print a warning.
* Use the `"error"` option to easy debugging to see where the error was thrown and when the offending read / write took place
*
* @param mode `"warn"`, `"error"` or `"ignore"`
*/
export function setLivelinessChecking(mode: LivelinessMode) {
livelinessChecking = mode
}
/**
* Returns the current liveliness checking mode.
*
* @returns `"warn"`, `"error"` or `"ignore"`
*/
export function getLivelinessChecking(): LivelinessMode {
return livelinessChecking
}
/**
* @deprecated use LivelinessMode instead
* @hidden
*/
export type LivelynessMode = LivelinessMode
/**
* @deprecated use setLivelinessChecking instead
* @hidden
*
* Defines what MST should do when running into reads / writes to objects that have died.
* By default it will print a warning.
* Use the `"error"` option to easy debugging to see where the error was thrown and when the offending read / write took place
*
* @param mode `"warn"`, `"error"` or `"ignore"`
*/
export function setLivelynessChecking(mode: LivelinessMode) {
setLivelinessChecking(mode)
}