File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,34 @@ type DeepReadonlyObject<T> = {
55
55
} ;
56
56
type NonFunctionPropertyNames < T > = { [ K in keyof T ] : T [ K ] extends Function ? never : K } [ keyof T ] ;
57
57
58
+ /**
59
+ * An object that can be disabled.
60
+ */
61
+ export class Disableable {
62
+ private enabled = true ;
63
+
64
+ /**
65
+ * True if the watcher is currently enabled.
66
+ */
67
+ public get isEnabled ( ) : boolean {
68
+ return this . enabled ;
69
+ }
70
+
71
+ /**
72
+ * Ensure that the watcher is enabled.
73
+ */
74
+ public enable ( ) {
75
+ this . enabled = true ;
76
+ }
77
+
78
+ /**
79
+ * Ensure that the watcher is disabled.
80
+ */
81
+ public disable ( ) {
82
+ this . enabled = false ;
83
+ }
84
+ }
85
+
58
86
// Information about a traced function/method call.
59
87
export type TraceInfo = {
60
88
elapsed : number ; // milliseconds
You can’t perform that action at this time.
0 commit comments