@sapphire/timer-manager 1.0.1-next.bd0d7d4e.0 → 1.0.1-next.bd487c72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Manages timers so that this application can be cleanly exited
3
+ */
4
+ declare class TimerManager extends null {
5
+ /**
6
+ * A set of timeouts to clear on destroy
7
+ */
8
+ private static storedTimeouts;
9
+ /**
10
+ * A set of intervals to clear on destroy
11
+ */
12
+ private static storedIntervals;
13
+ /**
14
+ * Creates a timeout gets cleared when destroyed
15
+ * @param fn callback function
16
+ * @param delay amount of time before running the callback
17
+ * @param args additional arguments to pass back to the callback
18
+ */
19
+ static setTimeout<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout;
20
+ /**
21
+ * Clears a timeout created through this class
22
+ * @param timeout The timeout to clear
23
+ */
24
+ static clearTimeout(timeout: NodeJS.Timeout): void;
25
+ /**
26
+ * Creates an interval gets cleared when destroyed
27
+ * @param fn callback function
28
+ * @param delay amount of time before running the callback
29
+ * @param args additional arguments to pass back to the callback
30
+ */
31
+ static setInterval<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout;
32
+ /**
33
+ * Clears an internal created through this class
34
+ * @param interval The interval to clear
35
+ */
36
+ static clearInterval(interval: NodeJS.Timeout): void;
37
+ /**
38
+ * Clears running timeouts and intervals created through this class so NodeJS can gracefully exit
39
+ */
40
+ static destroy(): void;
41
+ }
42
+
43
+ export { TimerManager };
@@ -10,7 +10,7 @@ var SapphireTimerManager = (function (exports) {
10
10
  };
11
11
 
12
12
  // src/lib/TimerManager.ts
13
- var TimerManager = class extends null {
13
+ var _TimerManager = class _TimerManager extends null {
14
14
  /**
15
15
  * Creates a timeout gets cleared when destroyed
16
16
  * @param fn callback function
@@ -64,15 +64,16 @@ var SapphireTimerManager = (function (exports) {
64
64
  this.storedIntervals.clear();
65
65
  }
66
66
  };
67
- __name(TimerManager, "TimerManager");
67
+ __name(_TimerManager, "TimerManager");
68
68
  /**
69
69
  * A set of timeouts to clear on destroy
70
70
  */
71
- __publicField(TimerManager, "storedTimeouts", /* @__PURE__ */ new Set());
71
+ __publicField(_TimerManager, "storedTimeouts", /* @__PURE__ */ new Set());
72
72
  /**
73
73
  * A set of intervals to clear on destroy
74
74
  */
75
- __publicField(TimerManager, "storedIntervals", /* @__PURE__ */ new Set());
75
+ __publicField(_TimerManager, "storedIntervals", /* @__PURE__ */ new Set());
76
+ var TimerManager = _TimerManager;
76
77
 
77
78
  exports.TimerManager = TimerManager;
78
79
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/TimerManager.ts"],"names":[],"mappings":";;;;;;;;;AAGO,IAAM,eAAN,cAA2B,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBtC,OAAc,WAAwB,IAA4B,UAAkB,MAA2B;AAC9G,UAAM,UAAU,WAAW,MAAM;AAChC,WAAK,eAAe,OAAO,OAAO;AAClC,SAAG,GAAG,IAAI;AAAA,IACX,GAAG,KAAK;AACR,SAAK,eAAe,IAAI,OAAO;AAC/B,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,aAAa,SAA+B;AACzD,iBAAa,OAAO;AACpB,SAAK,eAAe,OAAO,OAAO;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAc,YAAyB,IAA4B,UAAkB,MAA2B;AAC/G,UAAM,WAAW,YAAY,IAAI,OAAO,GAAG,IAAI;AAC/C,SAAK,gBAAgB,IAAI,QAAQ;AACjC,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,cAAc,UAAgC;AAC3D,kBAAc,QAAQ;AACtB,SAAK,gBAAgB,OAAO,QAAQ;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA,EAKA,OAAc,UAAgB;AAC7B,eAAW,KAAK,KAAK;AAAgB,mBAAa,CAAC;AACnD,eAAW,KAAK,KAAK;AAAiB,oBAAc,CAAC;AACrD,SAAK,eAAe,MAAM;AAC1B,SAAK,gBAAgB,MAAM;AAAA,EAC5B;AACD;AAjEa;AAAA;AAAA;AAAA;AAIZ,cAJY,cAIG,kBAAiB,oBAAI,IAAoB;AAAA;AAAA;AAAA;AAKxD,cATY,cASG,mBAAkB,oBAAI,IAAoB","sourcesContent":["/**\n * Manages timers so that this application can be cleanly exited\n */\nexport class TimerManager extends null {\n\t/**\n\t * A set of timeouts to clear on destroy\n\t */\n\tprivate static storedTimeouts = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * A set of intervals to clear on destroy\n\t */\n\tprivate static storedIntervals = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * Creates a timeout gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setTimeout<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst timeout = setTimeout(() => {\n\t\t\tthis.storedTimeouts.delete(timeout);\n\t\t\tfn(...args);\n\t\t}, delay);\n\t\tthis.storedTimeouts.add(timeout);\n\t\treturn timeout;\n\t}\n\n\t/**\n\t * Clears a timeout created through this class\n\t * @param timeout The timeout to clear\n\t */\n\tpublic static clearTimeout(timeout: NodeJS.Timeout): void {\n\t\tclearTimeout(timeout);\n\t\tthis.storedTimeouts.delete(timeout);\n\t}\n\n\t/**\n\t * Creates an interval gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setInterval<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst interval = setInterval(fn, delay, ...args);\n\t\tthis.storedIntervals.add(interval);\n\t\treturn interval;\n\t}\n\n\t/**\n\t * Clears an internal created through this class\n\t * @param interval The interval to clear\n\t */\n\tpublic static clearInterval(interval: NodeJS.Timeout): void {\n\t\tclearInterval(interval);\n\t\tthis.storedIntervals.delete(interval);\n\t}\n\n\t/**\n\t * Clears running timeouts and intervals created through this class so NodeJS can gracefully exit\n\t */\n\tpublic static destroy(): void {\n\t\tfor (const i of this.storedTimeouts) clearTimeout(i);\n\t\tfor (const i of this.storedIntervals) clearInterval(i);\n\t\tthis.storedTimeouts.clear();\n\t\tthis.storedIntervals.clear();\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/TimerManager.ts"],"names":[],"mappings":";;;;;;;;;AAGO,IAAM,gBAAN,MAAM,sBAAqB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBtC,OAAc,WAAwB,IAA4B,UAAkB,MAA2B;AAC9G,UAAM,UAAU,WAAW,MAAM;AAChC,WAAK,eAAe,OAAO,OAAO;AAClC,SAAG,GAAG,IAAI;AAAA,IACX,GAAG,KAAK;AACR,SAAK,eAAe,IAAI,OAAO;AAC/B,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,aAAa,SAA+B;AACzD,iBAAa,OAAO;AACpB,SAAK,eAAe,OAAO,OAAO;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAc,YAAyB,IAA4B,UAAkB,MAA2B;AAC/G,UAAM,WAAW,YAAY,IAAI,OAAO,GAAG,IAAI;AAC/C,SAAK,gBAAgB,IAAI,QAAQ;AACjC,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,cAAc,UAAgC;AAC3D,kBAAc,QAAQ;AACtB,SAAK,gBAAgB,OAAO,QAAQ;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA,EAKA,OAAc,UAAgB;AAC7B,eAAW,KAAK,KAAK;AAAgB,mBAAa,CAAC;AACnD,eAAW,KAAK,KAAK;AAAiB,oBAAc,CAAC;AACrD,SAAK,eAAe,MAAM;AAC1B,SAAK,gBAAgB,MAAM;AAAA,EAC5B;AACD;AAjEuC;AAAA;AAAA;AAAA;AAItC,cAJY,eAIG,kBAAiB,oBAAI,IAAoB;AAAA;AAAA;AAAA;AAKxD,cATY,eASG,mBAAkB,oBAAI,IAAoB;AATnD,IAAM,eAAN","sourcesContent":["/**\n * Manages timers so that this application can be cleanly exited\n */\nexport class TimerManager extends null {\n\t/**\n\t * A set of timeouts to clear on destroy\n\t */\n\tprivate static storedTimeouts = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * A set of intervals to clear on destroy\n\t */\n\tprivate static storedIntervals = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * Creates a timeout gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setTimeout<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst timeout = setTimeout(() => {\n\t\t\tthis.storedTimeouts.delete(timeout);\n\t\t\tfn(...args);\n\t\t}, delay);\n\t\tthis.storedTimeouts.add(timeout);\n\t\treturn timeout;\n\t}\n\n\t/**\n\t * Clears a timeout created through this class\n\t * @param timeout The timeout to clear\n\t */\n\tpublic static clearTimeout(timeout: NodeJS.Timeout): void {\n\t\tclearTimeout(timeout);\n\t\tthis.storedTimeouts.delete(timeout);\n\t}\n\n\t/**\n\t * Creates an interval gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setInterval<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst interval = setInterval(fn, delay, ...args);\n\t\tthis.storedIntervals.add(interval);\n\t\treturn interval;\n\t}\n\n\t/**\n\t * Clears an internal created through this class\n\t * @param interval The interval to clear\n\t */\n\tpublic static clearInterval(interval: NodeJS.Timeout): void {\n\t\tclearInterval(interval);\n\t\tthis.storedIntervals.delete(interval);\n\t}\n\n\t/**\n\t * Clears running timeouts and intervals created through this class so NodeJS can gracefully exit\n\t */\n\tpublic static destroy(): void {\n\t\tfor (const i of this.storedTimeouts) clearTimeout(i);\n\t\tfor (const i of this.storedIntervals) clearInterval(i);\n\t\tthis.storedTimeouts.clear();\n\t\tthis.storedIntervals.clear();\n\t}\n}\n"]}
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  };
10
10
 
11
11
  // src/lib/TimerManager.ts
12
- var TimerManager = class extends null {
12
+ var _TimerManager = class _TimerManager extends null {
13
13
  /**
14
14
  * Creates a timeout gets cleared when destroyed
15
15
  * @param fn callback function
@@ -63,15 +63,16 @@ var TimerManager = class extends null {
63
63
  this.storedIntervals.clear();
64
64
  }
65
65
  };
66
- __name(TimerManager, "TimerManager");
66
+ __name(_TimerManager, "TimerManager");
67
67
  /**
68
68
  * A set of timeouts to clear on destroy
69
69
  */
70
- __publicField(TimerManager, "storedTimeouts", /* @__PURE__ */ new Set());
70
+ __publicField(_TimerManager, "storedTimeouts", /* @__PURE__ */ new Set());
71
71
  /**
72
72
  * A set of intervals to clear on destroy
73
73
  */
74
- __publicField(TimerManager, "storedIntervals", /* @__PURE__ */ new Set());
74
+ __publicField(_TimerManager, "storedIntervals", /* @__PURE__ */ new Set());
75
+ var TimerManager = _TimerManager;
75
76
 
76
77
  exports.TimerManager = TimerManager;
77
78
  //# sourceMappingURL=out.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/TimerManager.ts"],"names":[],"mappings":";;;;;;;;;AAGO,IAAM,eAAN,cAA2B,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBtC,OAAc,WAAwB,IAA4B,UAAkB,MAA2B;AAC9G,UAAM,UAAU,WAAW,MAAM;AAChC,WAAK,eAAe,OAAO,OAAO;AAClC,SAAG,GAAG,IAAI;AAAA,IACX,GAAG,KAAK;AACR,SAAK,eAAe,IAAI,OAAO;AAC/B,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,aAAa,SAA+B;AACzD,iBAAa,OAAO;AACpB,SAAK,eAAe,OAAO,OAAO;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAc,YAAyB,IAA4B,UAAkB,MAA2B;AAC/G,UAAM,WAAW,YAAY,IAAI,OAAO,GAAG,IAAI;AAC/C,SAAK,gBAAgB,IAAI,QAAQ;AACjC,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,cAAc,UAAgC;AAC3D,kBAAc,QAAQ;AACtB,SAAK,gBAAgB,OAAO,QAAQ;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA,EAKA,OAAc,UAAgB;AAC7B,eAAW,KAAK,KAAK;AAAgB,mBAAa,CAAC;AACnD,eAAW,KAAK,KAAK;AAAiB,oBAAc,CAAC;AACrD,SAAK,eAAe,MAAM;AAC1B,SAAK,gBAAgB,MAAM;AAAA,EAC5B;AACD;AAjEa;AAAA;AAAA;AAAA;AAIZ,cAJY,cAIG,kBAAiB,oBAAI,IAAoB;AAAA;AAAA;AAAA;AAKxD,cATY,cASG,mBAAkB,oBAAI,IAAoB","sourcesContent":["/**\n * Manages timers so that this application can be cleanly exited\n */\nexport class TimerManager extends null {\n\t/**\n\t * A set of timeouts to clear on destroy\n\t */\n\tprivate static storedTimeouts = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * A set of intervals to clear on destroy\n\t */\n\tprivate static storedIntervals = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * Creates a timeout gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setTimeout<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst timeout = setTimeout(() => {\n\t\t\tthis.storedTimeouts.delete(timeout);\n\t\t\tfn(...args);\n\t\t}, delay);\n\t\tthis.storedTimeouts.add(timeout);\n\t\treturn timeout;\n\t}\n\n\t/**\n\t * Clears a timeout created through this class\n\t * @param timeout The timeout to clear\n\t */\n\tpublic static clearTimeout(timeout: NodeJS.Timeout): void {\n\t\tclearTimeout(timeout);\n\t\tthis.storedTimeouts.delete(timeout);\n\t}\n\n\t/**\n\t * Creates an interval gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setInterval<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst interval = setInterval(fn, delay, ...args);\n\t\tthis.storedIntervals.add(interval);\n\t\treturn interval;\n\t}\n\n\t/**\n\t * Clears an internal created through this class\n\t * @param interval The interval to clear\n\t */\n\tpublic static clearInterval(interval: NodeJS.Timeout): void {\n\t\tclearInterval(interval);\n\t\tthis.storedIntervals.delete(interval);\n\t}\n\n\t/**\n\t * Clears running timeouts and intervals created through this class so NodeJS can gracefully exit\n\t */\n\tpublic static destroy(): void {\n\t\tfor (const i of this.storedTimeouts) clearTimeout(i);\n\t\tfor (const i of this.storedIntervals) clearInterval(i);\n\t\tthis.storedTimeouts.clear();\n\t\tthis.storedIntervals.clear();\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/TimerManager.ts"],"names":[],"mappings":";;;;;;;;;AAGO,IAAM,gBAAN,MAAM,sBAAqB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBtC,OAAc,WAAwB,IAA4B,UAAkB,MAA2B;AAC9G,UAAM,UAAU,WAAW,MAAM;AAChC,WAAK,eAAe,OAAO,OAAO;AAClC,SAAG,GAAG,IAAI;AAAA,IACX,GAAG,KAAK;AACR,SAAK,eAAe,IAAI,OAAO;AAC/B,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,aAAa,SAA+B;AACzD,iBAAa,OAAO;AACpB,SAAK,eAAe,OAAO,OAAO;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAc,YAAyB,IAA4B,UAAkB,MAA2B;AAC/G,UAAM,WAAW,YAAY,IAAI,OAAO,GAAG,IAAI;AAC/C,SAAK,gBAAgB,IAAI,QAAQ;AACjC,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,cAAc,UAAgC;AAC3D,kBAAc,QAAQ;AACtB,SAAK,gBAAgB,OAAO,QAAQ;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA,EAKA,OAAc,UAAgB;AAC7B,eAAW,KAAK,KAAK;AAAgB,mBAAa,CAAC;AACnD,eAAW,KAAK,KAAK;AAAiB,oBAAc,CAAC;AACrD,SAAK,eAAe,MAAM;AAC1B,SAAK,gBAAgB,MAAM;AAAA,EAC5B;AACD;AAjEuC;AAAA;AAAA;AAAA;AAItC,cAJY,eAIG,kBAAiB,oBAAI,IAAoB;AAAA;AAAA;AAAA;AAKxD,cATY,eASG,mBAAkB,oBAAI,IAAoB;AATnD,IAAM,eAAN","sourcesContent":["/**\n * Manages timers so that this application can be cleanly exited\n */\nexport class TimerManager extends null {\n\t/**\n\t * A set of timeouts to clear on destroy\n\t */\n\tprivate static storedTimeouts = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * A set of intervals to clear on destroy\n\t */\n\tprivate static storedIntervals = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * Creates a timeout gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setTimeout<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst timeout = setTimeout(() => {\n\t\t\tthis.storedTimeouts.delete(timeout);\n\t\t\tfn(...args);\n\t\t}, delay);\n\t\tthis.storedTimeouts.add(timeout);\n\t\treturn timeout;\n\t}\n\n\t/**\n\t * Clears a timeout created through this class\n\t * @param timeout The timeout to clear\n\t */\n\tpublic static clearTimeout(timeout: NodeJS.Timeout): void {\n\t\tclearTimeout(timeout);\n\t\tthis.storedTimeouts.delete(timeout);\n\t}\n\n\t/**\n\t * Creates an interval gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setInterval<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst interval = setInterval(fn, delay, ...args);\n\t\tthis.storedIntervals.add(interval);\n\t\treturn interval;\n\t}\n\n\t/**\n\t * Clears an internal created through this class\n\t * @param interval The interval to clear\n\t */\n\tpublic static clearInterval(interval: NodeJS.Timeout): void {\n\t\tclearInterval(interval);\n\t\tthis.storedIntervals.delete(interval);\n\t}\n\n\t/**\n\t * Clears running timeouts and intervals created through this class so NodeJS can gracefully exit\n\t */\n\tpublic static destroy(): void {\n\t\tfor (const i of this.storedTimeouts) clearTimeout(i);\n\t\tfor (const i of this.storedIntervals) clearInterval(i);\n\t\tthis.storedTimeouts.clear();\n\t\tthis.storedIntervals.clear();\n\t}\n}\n"]}
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ var __publicField = (obj, key, value) => {
7
7
  };
8
8
 
9
9
  // src/lib/TimerManager.ts
10
- var TimerManager = class extends null {
10
+ var _TimerManager = class _TimerManager extends null {
11
11
  /**
12
12
  * Creates a timeout gets cleared when destroyed
13
13
  * @param fn callback function
@@ -61,15 +61,16 @@ var TimerManager = class extends null {
61
61
  this.storedIntervals.clear();
62
62
  }
63
63
  };
64
- __name(TimerManager, "TimerManager");
64
+ __name(_TimerManager, "TimerManager");
65
65
  /**
66
66
  * A set of timeouts to clear on destroy
67
67
  */
68
- __publicField(TimerManager, "storedTimeouts", /* @__PURE__ */ new Set());
68
+ __publicField(_TimerManager, "storedTimeouts", /* @__PURE__ */ new Set());
69
69
  /**
70
70
  * A set of intervals to clear on destroy
71
71
  */
72
- __publicField(TimerManager, "storedIntervals", /* @__PURE__ */ new Set());
72
+ __publicField(_TimerManager, "storedIntervals", /* @__PURE__ */ new Set());
73
+ var TimerManager = _TimerManager;
73
74
 
74
75
  export { TimerManager };
75
76
  //# sourceMappingURL=out.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/TimerManager.ts"],"names":[],"mappings":";;;;;;;;;AAGO,IAAM,eAAN,cAA2B,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBtC,OAAc,WAAwB,IAA4B,UAAkB,MAA2B;AAC9G,UAAM,UAAU,WAAW,MAAM;AAChC,WAAK,eAAe,OAAO,OAAO;AAClC,SAAG,GAAG,IAAI;AAAA,IACX,GAAG,KAAK;AACR,SAAK,eAAe,IAAI,OAAO;AAC/B,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,aAAa,SAA+B;AACzD,iBAAa,OAAO;AACpB,SAAK,eAAe,OAAO,OAAO;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAc,YAAyB,IAA4B,UAAkB,MAA2B;AAC/G,UAAM,WAAW,YAAY,IAAI,OAAO,GAAG,IAAI;AAC/C,SAAK,gBAAgB,IAAI,QAAQ;AACjC,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,cAAc,UAAgC;AAC3D,kBAAc,QAAQ;AACtB,SAAK,gBAAgB,OAAO,QAAQ;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA,EAKA,OAAc,UAAgB;AAC7B,eAAW,KAAK,KAAK;AAAgB,mBAAa,CAAC;AACnD,eAAW,KAAK,KAAK;AAAiB,oBAAc,CAAC;AACrD,SAAK,eAAe,MAAM;AAC1B,SAAK,gBAAgB,MAAM;AAAA,EAC5B;AACD;AAjEa;AAAA;AAAA;AAAA;AAIZ,cAJY,cAIG,kBAAiB,oBAAI,IAAoB;AAAA;AAAA;AAAA;AAKxD,cATY,cASG,mBAAkB,oBAAI,IAAoB","sourcesContent":["/**\n * Manages timers so that this application can be cleanly exited\n */\nexport class TimerManager extends null {\n\t/**\n\t * A set of timeouts to clear on destroy\n\t */\n\tprivate static storedTimeouts = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * A set of intervals to clear on destroy\n\t */\n\tprivate static storedIntervals = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * Creates a timeout gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setTimeout<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst timeout = setTimeout(() => {\n\t\t\tthis.storedTimeouts.delete(timeout);\n\t\t\tfn(...args);\n\t\t}, delay);\n\t\tthis.storedTimeouts.add(timeout);\n\t\treturn timeout;\n\t}\n\n\t/**\n\t * Clears a timeout created through this class\n\t * @param timeout The timeout to clear\n\t */\n\tpublic static clearTimeout(timeout: NodeJS.Timeout): void {\n\t\tclearTimeout(timeout);\n\t\tthis.storedTimeouts.delete(timeout);\n\t}\n\n\t/**\n\t * Creates an interval gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setInterval<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst interval = setInterval(fn, delay, ...args);\n\t\tthis.storedIntervals.add(interval);\n\t\treturn interval;\n\t}\n\n\t/**\n\t * Clears an internal created through this class\n\t * @param interval The interval to clear\n\t */\n\tpublic static clearInterval(interval: NodeJS.Timeout): void {\n\t\tclearInterval(interval);\n\t\tthis.storedIntervals.delete(interval);\n\t}\n\n\t/**\n\t * Clears running timeouts and intervals created through this class so NodeJS can gracefully exit\n\t */\n\tpublic static destroy(): void {\n\t\tfor (const i of this.storedTimeouts) clearTimeout(i);\n\t\tfor (const i of this.storedIntervals) clearInterval(i);\n\t\tthis.storedTimeouts.clear();\n\t\tthis.storedIntervals.clear();\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/TimerManager.ts"],"names":[],"mappings":";;;;;;;;;AAGO,IAAM,gBAAN,MAAM,sBAAqB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBtC,OAAc,WAAwB,IAA4B,UAAkB,MAA2B;AAC9G,UAAM,UAAU,WAAW,MAAM;AAChC,WAAK,eAAe,OAAO,OAAO;AAClC,SAAG,GAAG,IAAI;AAAA,IACX,GAAG,KAAK;AACR,SAAK,eAAe,IAAI,OAAO;AAC/B,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,aAAa,SAA+B;AACzD,iBAAa,OAAO;AACpB,SAAK,eAAe,OAAO,OAAO;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAc,YAAyB,IAA4B,UAAkB,MAA2B;AAC/G,UAAM,WAAW,YAAY,IAAI,OAAO,GAAG,IAAI;AAC/C,SAAK,gBAAgB,IAAI,QAAQ;AACjC,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAc,cAAc,UAAgC;AAC3D,kBAAc,QAAQ;AACtB,SAAK,gBAAgB,OAAO,QAAQ;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA,EAKA,OAAc,UAAgB;AAC7B,eAAW,KAAK,KAAK;AAAgB,mBAAa,CAAC;AACnD,eAAW,KAAK,KAAK;AAAiB,oBAAc,CAAC;AACrD,SAAK,eAAe,MAAM;AAC1B,SAAK,gBAAgB,MAAM;AAAA,EAC5B;AACD;AAjEuC;AAAA;AAAA;AAAA;AAItC,cAJY,eAIG,kBAAiB,oBAAI,IAAoB;AAAA;AAAA;AAAA;AAKxD,cATY,eASG,mBAAkB,oBAAI,IAAoB;AATnD,IAAM,eAAN","sourcesContent":["/**\n * Manages timers so that this application can be cleanly exited\n */\nexport class TimerManager extends null {\n\t/**\n\t * A set of timeouts to clear on destroy\n\t */\n\tprivate static storedTimeouts = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * A set of intervals to clear on destroy\n\t */\n\tprivate static storedIntervals = new Set<NodeJS.Timeout>();\n\n\t/**\n\t * Creates a timeout gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setTimeout<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst timeout = setTimeout(() => {\n\t\t\tthis.storedTimeouts.delete(timeout);\n\t\t\tfn(...args);\n\t\t}, delay);\n\t\tthis.storedTimeouts.add(timeout);\n\t\treturn timeout;\n\t}\n\n\t/**\n\t * Clears a timeout created through this class\n\t * @param timeout The timeout to clear\n\t */\n\tpublic static clearTimeout(timeout: NodeJS.Timeout): void {\n\t\tclearTimeout(timeout);\n\t\tthis.storedTimeouts.delete(timeout);\n\t}\n\n\t/**\n\t * Creates an interval gets cleared when destroyed\n\t * @param fn callback function\n\t * @param delay amount of time before running the callback\n\t * @param args additional arguments to pass back to the callback\n\t */\n\tpublic static setInterval<A = unknown>(fn: (...args: A[]) => void, delay: number, ...args: A[]): NodeJS.Timeout {\n\t\tconst interval = setInterval(fn, delay, ...args);\n\t\tthis.storedIntervals.add(interval);\n\t\treturn interval;\n\t}\n\n\t/**\n\t * Clears an internal created through this class\n\t * @param interval The interval to clear\n\t */\n\tpublic static clearInterval(interval: NodeJS.Timeout): void {\n\t\tclearInterval(interval);\n\t\tthis.storedIntervals.delete(interval);\n\t}\n\n\t/**\n\t * Clears running timeouts and intervals created through this class so NodeJS can gracefully exit\n\t */\n\tpublic static destroy(): void {\n\t\tfor (const i of this.storedTimeouts) clearTimeout(i);\n\t\tfor (const i of this.storedIntervals) clearInterval(i);\n\t\tthis.storedTimeouts.clear();\n\t\tthis.storedIntervals.clear();\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/timer-manager",
3
- "version": "1.0.1-next.bd0d7d4e.0",
3
+ "version": "1.0.1-next.bd487c72.0",
4
4
  "description": "A timer manager utility library for JavaScript.",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
@@ -10,9 +10,14 @@
10
10
  "unpkg": "dist/index.global.js",
11
11
  "types": "dist/index.d.ts",
12
12
  "exports": {
13
- "import": "./dist/index.mjs",
14
- "require": "./dist/index.js",
15
- "types": "./dist/index.d.ts"
13
+ "import": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.mjs"
16
+ },
17
+ "require": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ }
16
21
  },
17
22
  "sideEffects": false,
18
23
  "homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/timer-manager",
@@ -57,12 +62,12 @@
57
62
  "access": "public"
58
63
  },
59
64
  "devDependencies": {
60
- "@favware/cliff-jumper": "^2.0.0",
61
- "@vitest/coverage-c8": "^0.30.1",
62
- "tsup": "^6.7.0",
63
- "typedoc": "^0.24.6",
64
- "typedoc-json-parser": "^7.3.1",
65
- "typescript": "^5.0.4",
66
- "vitest": "^0.30.1"
65
+ "@favware/cliff-jumper": "^2.1.2",
66
+ "@vitest/coverage-v8": "^0.34.3",
67
+ "tsup": "^7.2.0",
68
+ "typedoc": "^0.25.0",
69
+ "typedoc-json-parser": "^8.2.0",
70
+ "typescript": "^5.2.2",
71
+ "vitest": "^0.34.3"
67
72
  }
68
73
  }