@oscarpalmer/timer 0.30.0 → 0.31.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.
- package/dist/get.cjs +1 -1
- package/dist/get.js +1 -1
- package/dist/timer.cjs +6 -0
- package/dist/timer.full.js +4 -0
- package/dist/timer.js +6 -0
- package/dist/when.cjs +1 -1
- package/dist/when.js +1 -1
- package/package.json +1 -1
- package/src/timer.ts +7 -0
- package/dist/node_modules/@oscarpalmer/atoms/dist/function.cjs +0 -8
- package/dist/node_modules/@oscarpalmer/atoms/dist/function.js +0 -4
package/dist/get.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const _function = require('
|
|
5
|
+
const _function = require('@oscarpalmer/atoms/function');
|
|
6
6
|
|
|
7
7
|
function getCallback(value) {
|
|
8
8
|
return typeof value === "function" ? value : _function.noop;
|
package/dist/get.js
CHANGED
package/dist/timer.cjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
+
const _function = require('@oscarpalmer/atoms/function');
|
|
6
|
+
|
|
5
7
|
class Timer {
|
|
6
8
|
constructor(type, worker, state, options, start) {
|
|
7
9
|
this.worker = worker;
|
|
@@ -57,6 +59,10 @@ class Timer {
|
|
|
57
59
|
*/
|
|
58
60
|
destroy() {
|
|
59
61
|
this.state.destroyed = true;
|
|
62
|
+
this.options.onAfter = _function.noop;
|
|
63
|
+
this.options.onError = _function.noop;
|
|
64
|
+
this.state.callback = _function.noop;
|
|
65
|
+
this.state.trace = void 0;
|
|
60
66
|
this.#work("stop");
|
|
61
67
|
}
|
|
62
68
|
/**
|
package/dist/timer.full.js
CHANGED
package/dist/timer.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { noop } from '@oscarpalmer/atoms/function';
|
|
2
|
+
|
|
1
3
|
class Timer {
|
|
2
4
|
constructor(type, worker, state, options, start) {
|
|
3
5
|
this.worker = worker;
|
|
@@ -53,6 +55,10 @@ class Timer {
|
|
|
53
55
|
*/
|
|
54
56
|
destroy() {
|
|
55
57
|
this.state.destroyed = true;
|
|
58
|
+
this.options.onAfter = noop;
|
|
59
|
+
this.options.onError = noop;
|
|
60
|
+
this.state.callback = noop;
|
|
61
|
+
this.state.trace = void 0;
|
|
56
62
|
this.#work("stop");
|
|
57
63
|
}
|
|
58
64
|
/**
|
package/dist/when.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const _function = require('
|
|
5
|
+
const _function = require('@oscarpalmer/atoms/function');
|
|
6
6
|
const constants = require('./constants.cjs');
|
|
7
7
|
const get = require('./get.cjs');
|
|
8
8
|
const models = require('./models.cjs');
|
package/dist/when.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { noop } from '
|
|
1
|
+
import { noop } from '@oscarpalmer/atoms/function';
|
|
2
2
|
import { milliseconds, destroyedMessage, startedMessage } from './constants.js';
|
|
3
3
|
import { getValidNumber } from './get.js';
|
|
4
4
|
import { TimerTrace } from './models.js';
|
package/package.json
CHANGED
package/src/timer.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {noop} from '@oscarpalmer/atoms/function';
|
|
1
2
|
import type {
|
|
2
3
|
TimerOptions,
|
|
3
4
|
TimerState,
|
|
@@ -79,6 +80,12 @@ export class Timer {
|
|
|
79
80
|
destroy(): void {
|
|
80
81
|
this.state.destroyed = true;
|
|
81
82
|
|
|
83
|
+
this.options.onAfter = noop;
|
|
84
|
+
this.options.onError = noop;
|
|
85
|
+
|
|
86
|
+
this.state.callback = noop;
|
|
87
|
+
this.state.trace = undefined;
|
|
88
|
+
|
|
82
89
|
this.#work('stop');
|
|
83
90
|
}
|
|
84
91
|
|