tiny-essentials 1.28.0 → 1.28.1
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/changelog/1/28/1.md +23 -0
- package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyAnalogClock.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyDayNightCycle.min.js +1 -1
- package/dist/v1/TinyDragDropDetector.min.js +1 -1
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyElementObserver.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyGamepad.min.js +1 -1
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyI18.min.js +1 -1
- package/dist/v1/TinyIframeEvents.min.js +1 -1
- package/dist/v1/TinyLocalStorage.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyNewWinEvents.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTextDiffer.min.js +1 -1
- package/dist/v1/TinyTextarea.min.js +1 -1
- package/dist/v1/TinyTimeout.min.js +1 -1
- package/dist/v1/TinyToastNotify.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/array.cjs +57 -9
- package/dist/v1/basics/array.d.mts +27 -11
- package/dist/v1/basics/array.mjs +51 -9
- package/dist/v1/basics/clock.cjs +94 -42
- package/dist/v1/basics/clock.d.mts +10 -10
- package/dist/v1/basics/clock.mjs +91 -54
- package/dist/v1/basics/deprecated/html.cjs +246 -0
- package/dist/v1/basics/deprecated/html.d.mts +63 -0
- package/dist/v1/basics/deprecated/html.mjs +190 -0
- package/dist/v1/basics/html.cjs +149 -130
- package/dist/v1/basics/html.d.mts +26 -61
- package/dist/v1/basics/html.mjs +113 -105
- package/dist/v1/basics/index.cjs +2 -0
- package/dist/v1/basics/index.d.mts +3 -1
- package/dist/v1/basics/index.mjs +3 -3
- package/dist/v1/basics/mediaContent.cjs +51 -9
- package/dist/v1/basics/mediaContent.d.mts +0 -87
- package/dist/v1/basics/mediaContent.mjs +40 -10
- package/dist/v1/basics/objChecker.cjs +7 -5
- package/dist/v1/basics/objChecker.d.mts +3 -2
- package/dist/v1/basics/objChecker.mjs +6 -6
- package/dist/v1/basics/objFilter.cjs +40 -7
- package/dist/v1/basics/objFilter.d.mts +6 -6
- package/dist/v1/basics/objFilter.mjs +32 -7
- package/dist/v1/basics/simpleMath.cjs +81 -25
- package/dist/v1/basics/simpleMath.d.mts +2 -2
- package/dist/v1/basics/simpleMath.mjs +70 -27
- package/dist/v1/basics/text.cjs +76 -31
- package/dist/v1/basics/text.d.mts +69 -7
- package/dist/v1/basics/text.mjs +62 -31
- package/dist/v1/index.cjs +4 -0
- package/dist/v1/index.d.mts +4 -1
- package/dist/v1/index.mjs +4 -3
- package/dist/v1/libs/TinyAdvancedRaffle.cjs +64 -50
- package/dist/v1/libs/TinyAdvancedRaffle.d.mts +4 -13
- package/dist/v1/libs/TinyAdvancedRaffle.mjs +62 -49
- package/dist/v1/libs/TinyAfterScrollWatcher.cjs +17 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +4 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.mjs +15 -1
- package/dist/v1/libs/TinyAnalogClock.cjs +60 -0
- package/dist/v1/libs/TinyAnalogClock.d.mts +6 -0
- package/dist/v1/libs/TinyAnalogClock.mjs +57 -0
- package/dist/v1/libs/TinyClipboard.cjs +2 -0
- package/dist/v1/libs/TinyClipboard.d.mts +4 -2
- package/dist/v1/libs/TinyClipboard.mjs +2 -0
- package/dist/v1/libs/TinyColorConverter.cjs +1 -0
- package/dist/v1/libs/TinyColorConverter.d.mts +2 -1
- package/dist/v1/libs/TinyColorConverter.mjs +1 -0
- package/dist/v1/libs/TinyDayNightCycle.cjs +67 -42
- package/dist/v1/libs/TinyDayNightCycle.d.mts +2 -7
- package/dist/v1/libs/TinyDayNightCycle.mjs +65 -41
- package/dist/v1/libs/TinyDragDropDetector.cjs +25 -0
- package/dist/v1/libs/TinyDragDropDetector.d.mts +6 -0
- package/dist/v1/libs/TinyDragDropDetector.mjs +22 -0
- package/dist/v1/libs/TinyDragger.cjs +46 -19
- package/dist/v1/libs/TinyDragger.mjs +45 -18
- package/dist/v1/libs/TinyElementObserver.cjs +39 -0
- package/dist/v1/libs/TinyElementObserver.d.mts +6 -0
- package/dist/v1/libs/TinyElementObserver.mjs +36 -0
- package/dist/v1/libs/TinyGamepad.cjs +131 -1
- package/dist/v1/libs/TinyGamepad.mjs +129 -1
- package/dist/v1/libs/TinyHtml.cjs +1 -1
- package/dist/v1/libs/TinyHtml.mjs +2 -2
- package/dist/v1/libs/TinyI18.cjs +61 -0
- package/dist/v1/libs/TinyI18.d.mts +14 -0
- package/dist/v1/libs/TinyI18.mjs +55 -0
- package/dist/v1/libs/TinyIframeEvents.cjs +18 -1
- package/dist/v1/libs/TinyIframeEvents.mjs +18 -1
- package/dist/v1/libs/TinyLocalStorage.cjs +48 -0
- package/dist/v1/libs/TinyLocalStorage.d.mts +6 -0
- package/dist/v1/libs/TinyLocalStorage.mjs +45 -0
- package/dist/v1/libs/TinyMediaPlayer.cjs +72 -0
- package/dist/v1/libs/TinyMediaPlayer.d.mts +10 -0
- package/dist/v1/libs/TinyMediaPlayer.mjs +66 -0
- package/dist/v1/libs/TinyNewWinEvents.cjs +29 -0
- package/dist/v1/libs/TinyNewWinEvents.d.mts +6 -0
- package/dist/v1/libs/TinyNewWinEvents.mjs +26 -0
- package/dist/v1/libs/TinyNotifyCenter.cjs +36 -0
- package/dist/v1/libs/TinyNotifyCenter.d.mts +6 -0
- package/dist/v1/libs/TinyNotifyCenter.mjs +32 -0
- package/dist/v1/libs/TinyRadioFm.cjs +38 -0
- package/dist/v1/libs/TinyRadioFm.d.mts +1 -0
- package/dist/v1/libs/TinyRadioFm.mjs +35 -0
- package/dist/v1/libs/TinyRateLimiter.cjs +52 -0
- package/dist/v1/libs/TinyRateLimiter.d.mts +6 -0
- package/dist/v1/libs/TinyRateLimiter.mjs +48 -0
- package/dist/v1/libs/TinySmartScroller.cjs +52 -3
- package/dist/v1/libs/TinySmartScroller.d.mts +17 -15
- package/dist/v1/libs/TinySmartScroller.mjs +51 -5
- package/dist/v1/libs/TinyTextDiffer.cjs +19 -18
- package/dist/v1/libs/TinyTextDiffer.d.mts +1 -0
- package/dist/v1/libs/TinyTextDiffer.mjs +16 -17
- package/dist/v1/libs/TinyTextarea.cjs +19 -0
- package/dist/v1/libs/TinyTextarea.d.mts +6 -0
- package/dist/v1/libs/TinyTextarea.mjs +17 -0
- package/dist/v1/libs/TinyTimeout.cjs +11 -1
- package/dist/v1/libs/TinyTimeout.mjs +9 -1
- package/dist/v1/libs/TinyToastNotify.cjs +35 -0
- package/dist/v1/libs/TinyToastNotify.d.mts +6 -0
- package/dist/v1/libs/TinyToastNotify.mjs +31 -0
- package/dist/v1/libs/TinyUploadClicker.cjs +19 -0
- package/dist/v1/libs/TinyUploadClicker.d.mts +6 -0
- package/dist/v1/libs/TinyUploadClicker.mjs +17 -0
- package/dist/v1/libs/UltraRandomMsgGen.cjs +148 -35
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +17 -3
- package/dist/v1/libs/UltraRandomMsgGen.mjs +133 -34
- package/dist/v1/libs/utils.cjs +21 -0
- package/dist/v1/libs/utils.d.mts +2 -0
- package/dist/v1/libs/utils.mjs +16 -0
- package/docs/v1/README.md +1 -0
- package/docs/v1/basics/array.md +2 -2
- package/docs/v1/basics/deprecated/html.md +17 -0
- package/docs/v1/basics/fullScreen.md +1 -1
- package/docs/v1/basics/html.md +12 -26
- package/docs/v1/basics/mediaContent.md +1 -1
- package/docs/v1/basics/objChecker.md +1 -1
- package/docs/v1/basics/text.md +2 -2
- package/docs/v1/fileManager/main.md +1 -1
- package/docs/v1/libs/ColorSafeStringify.md +1 -1
- package/docs/v1/libs/TinyAfterScrollWatcher.md +1 -1
- package/docs/v1/libs/TinyAnalogClock.md +1 -1
- package/docs/v1/libs/TinyArrayComparator.md +1 -1
- package/docs/v1/libs/TinyArrayPaginator.md +1 -1
- package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +2 -2
- package/docs/v1/libs/TinyClassManager.md +1 -1
- package/docs/v1/libs/TinyClipboard.md +1 -1
- package/docs/v1/libs/TinyCookieConsent.md +1 -1
- package/docs/v1/libs/TinyDomReadyManager.md +1 -1
- package/docs/v1/libs/TinyDragDropDetector.md +1 -1
- package/docs/v1/libs/TinyDragger.md +1 -1
- package/docs/v1/libs/TinyElementObserver.md +1 -1
- package/docs/v1/libs/TinyHtml.md +1 -1
- package/docs/v1/libs/TinyIframeEvents.md +2 -2
- package/docs/v1/libs/TinyLevelUp.md +1 -1
- package/docs/v1/libs/TinyLoadingScreen.md +1 -1
- package/docs/v1/libs/TinyNewWinEvents.md +2 -2
- package/docs/v1/libs/TinyNotifications.md +1 -1
- package/docs/v1/libs/TinyPromiseQueue.md +2 -2
- package/docs/v1/libs/TinyTextDiffer.md +1 -1
- package/docs/v1/libs/TinyTextarea.md +1 -1
- package/package.json +10 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createCheckDestroyed } from './utils.mjs';
|
|
2
|
+
const checkDestroy = createCheckDestroyed('TinyAfterScrollWatcher');
|
|
1
3
|
/**
|
|
2
4
|
* @typedef {(() => void)} FnData - Function with no arguments and no return value
|
|
3
5
|
*/
|
|
@@ -16,6 +18,7 @@ class TinyAfterScrollWatcher {
|
|
|
16
18
|
/** @type {ScrollElement} */
|
|
17
19
|
#scrollTarget;
|
|
18
20
|
get scrollTarget() {
|
|
21
|
+
checkDestroy(this.#destroyed);
|
|
19
22
|
return this.#scrollTarget;
|
|
20
23
|
}
|
|
21
24
|
/** @type {null|NodeJS.Timeout} */
|
|
@@ -23,6 +26,7 @@ class TinyAfterScrollWatcher {
|
|
|
23
26
|
/** @type {FnData[]} */
|
|
24
27
|
#afterScrollQueue = [];
|
|
25
28
|
get afterScrollQueueSize() {
|
|
29
|
+
checkDestroy(this.#destroyed);
|
|
26
30
|
return this.#afterScrollQueue.length;
|
|
27
31
|
}
|
|
28
32
|
/** @type {number} */
|
|
@@ -50,6 +54,9 @@ class TinyAfterScrollWatcher {
|
|
|
50
54
|
this.#scrollTarget.addEventListener('scroll', this._checkTimer);
|
|
51
55
|
this.#inactivityTime = inactivityTime;
|
|
52
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
53
60
|
_checkTimer = () => {
|
|
54
61
|
if (this.#lastScrollTime)
|
|
55
62
|
clearTimeout(this.#lastScrollTime);
|
|
@@ -63,6 +70,7 @@ class TinyAfterScrollWatcher {
|
|
|
63
70
|
* @returns {number}
|
|
64
71
|
*/
|
|
65
72
|
get inactivityTime() {
|
|
73
|
+
checkDestroy(this.#destroyed);
|
|
66
74
|
return this.#inactivityTime;
|
|
67
75
|
}
|
|
68
76
|
/**
|
|
@@ -72,6 +80,7 @@ class TinyAfterScrollWatcher {
|
|
|
72
80
|
* @throws {Error} If value is not a positive number
|
|
73
81
|
*/
|
|
74
82
|
set inactivityTime(value) {
|
|
83
|
+
checkDestroy(this.#destroyed);
|
|
75
84
|
if (typeof value !== 'number' || value <= 0 || !Number.isFinite(value))
|
|
76
85
|
throw new Error('inactivityTime must be a positive number in milliseconds.');
|
|
77
86
|
this.#inactivityTime = value;
|
|
@@ -103,6 +112,7 @@ class TinyAfterScrollWatcher {
|
|
|
103
112
|
* @throws {TypeError} If the argument is not a function.
|
|
104
113
|
*/
|
|
105
114
|
doAfterScroll(fn) {
|
|
115
|
+
checkDestroy(this.#destroyed);
|
|
106
116
|
if (typeof fn !== 'function')
|
|
107
117
|
throw new TypeError('Argument must be a function.');
|
|
108
118
|
this.lastScrollTime = Date.now();
|
|
@@ -116,6 +126,7 @@ class TinyAfterScrollWatcher {
|
|
|
116
126
|
* @throws {TypeError} If the argument is not a function.
|
|
117
127
|
*/
|
|
118
128
|
onStop(fn) {
|
|
129
|
+
checkDestroy(this.#destroyed);
|
|
119
130
|
if (typeof fn !== 'function')
|
|
120
131
|
throw new TypeError('Argument must be a function.');
|
|
121
132
|
this.#onStopListeners.add(fn);
|
|
@@ -127,6 +138,7 @@ class TinyAfterScrollWatcher {
|
|
|
127
138
|
* @throws {TypeError} If the argument is not a function.
|
|
128
139
|
*/
|
|
129
140
|
offStop(fn) {
|
|
141
|
+
checkDestroy(this.#destroyed);
|
|
130
142
|
if (typeof fn !== 'function')
|
|
131
143
|
throw new TypeError('Argument must be a function.');
|
|
132
144
|
this.#onStopListeners.delete(fn);
|
|
@@ -138,6 +150,7 @@ class TinyAfterScrollWatcher {
|
|
|
138
150
|
* @throws {TypeError} If the argument is not a function.
|
|
139
151
|
*/
|
|
140
152
|
onScroll(fn) {
|
|
153
|
+
checkDestroy(this.#destroyed);
|
|
141
154
|
if (typeof fn !== 'function')
|
|
142
155
|
throw new TypeError('Argument must be a function.');
|
|
143
156
|
this.#scrollTarget.addEventListener('scroll', fn);
|
|
@@ -150,6 +163,7 @@ class TinyAfterScrollWatcher {
|
|
|
150
163
|
* @throws {TypeError} If the argument is not a function.
|
|
151
164
|
*/
|
|
152
165
|
offScroll(fn) {
|
|
166
|
+
checkDestroy(this.#destroyed);
|
|
153
167
|
if (typeof fn !== 'function')
|
|
154
168
|
throw new TypeError('Argument must be a function.');
|
|
155
169
|
if (this.#externalScrollListeners.has(fn)) {
|
|
@@ -163,12 +177,12 @@ class TinyAfterScrollWatcher {
|
|
|
163
177
|
destroy() {
|
|
164
178
|
if (this.#destroyed)
|
|
165
179
|
return;
|
|
166
|
-
this.#destroyed = true;
|
|
167
180
|
this.#scrollTarget.removeEventListener('scroll', this._checkTimer);
|
|
168
181
|
for (const fn of this.#externalScrollListeners)
|
|
169
182
|
this.#scrollTarget.removeEventListener('scroll', fn);
|
|
170
183
|
this.#externalScrollListeners.clear();
|
|
171
184
|
this.#onStopListeners.clear();
|
|
185
|
+
this.#destroyed = true;
|
|
172
186
|
}
|
|
173
187
|
}
|
|
174
188
|
export default TinyAfterScrollWatcher;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var utils = require('./utils.cjs');
|
|
4
|
+
|
|
5
|
+
const checkDestroy = utils.createCheckDestroyed('TinyAnalogClock');
|
|
6
|
+
|
|
3
7
|
/**
|
|
4
8
|
* Configuration object for the Analog Clock.
|
|
5
9
|
* @typedef {Object} ClockConfig
|
|
@@ -36,6 +40,21 @@ class TinyAnalogClock {
|
|
|
36
40
|
/** @type {number|null} */
|
|
37
41
|
#animationFrame = null;
|
|
38
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Tracks whether the instance has been destroyed.
|
|
45
|
+
* @type {boolean}
|
|
46
|
+
*/
|
|
47
|
+
#destroyed = false;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Gets the current destruction status of the instance.
|
|
51
|
+
*
|
|
52
|
+
* @returns {boolean} True if the instance is destroyed, false otherwise.
|
|
53
|
+
*/
|
|
54
|
+
get destroyed() {
|
|
55
|
+
return this.#destroyed;
|
|
56
|
+
}
|
|
57
|
+
|
|
39
58
|
/**
|
|
40
59
|
* Retrieves the current date and extracts the specific hour, minute, and second components.
|
|
41
60
|
* @returns {{ now: Date, s: number, m: number, h: number }}
|
|
@@ -332,6 +351,7 @@ class TinyAnalogClock {
|
|
|
332
351
|
* @returns {HTMLElement} The clock container.
|
|
333
352
|
*/
|
|
334
353
|
get element() {
|
|
354
|
+
checkDestroy(this.#destroyed);
|
|
335
355
|
return this.#element;
|
|
336
356
|
}
|
|
337
357
|
|
|
@@ -341,6 +361,7 @@ class TinyAnalogClock {
|
|
|
341
361
|
* @throws {Error} If value is not a positive number.
|
|
342
362
|
*/
|
|
343
363
|
set size(value) {
|
|
364
|
+
checkDestroy(this.#destroyed);
|
|
344
365
|
if (typeof value !== 'number' || value <= 0 || isNaN(value)) {
|
|
345
366
|
throw new Error(`TinyAnalogClock: 'size' must be a positive number. Received: ${value}`);
|
|
346
367
|
}
|
|
@@ -353,6 +374,7 @@ class TinyAnalogClock {
|
|
|
353
374
|
* @returns {number}
|
|
354
375
|
*/
|
|
355
376
|
get size() {
|
|
377
|
+
checkDestroy(this.#destroyed);
|
|
356
378
|
return this.#config.size;
|
|
357
379
|
}
|
|
358
380
|
|
|
@@ -362,6 +384,7 @@ class TinyAnalogClock {
|
|
|
362
384
|
* @throws {Error} If value is not a string or null.
|
|
363
385
|
*/
|
|
364
386
|
set skinUrl(url) {
|
|
387
|
+
checkDestroy(this.#destroyed);
|
|
365
388
|
if (url !== null && typeof url !== 'string') {
|
|
366
389
|
throw new Error(
|
|
367
390
|
`TinyAnalogClock: 'skin' must be a URL string or null. Received type: ${typeof url}`,
|
|
@@ -376,6 +399,7 @@ class TinyAnalogClock {
|
|
|
376
399
|
* @returns {string|null}
|
|
377
400
|
*/
|
|
378
401
|
get skinUrl() {
|
|
402
|
+
checkDestroy(this.#destroyed);
|
|
379
403
|
return this.#config.skinUrl;
|
|
380
404
|
}
|
|
381
405
|
|
|
@@ -385,6 +409,7 @@ class TinyAnalogClock {
|
|
|
385
409
|
* @throws {Error} If value is not a non-empty string.
|
|
386
410
|
*/
|
|
387
411
|
set borderColor(color) {
|
|
412
|
+
checkDestroy(this.#destroyed);
|
|
388
413
|
if (typeof color !== 'string' || color.trim() === '') {
|
|
389
414
|
throw new Error(
|
|
390
415
|
`TinyAnalogClock: 'borderColor' must be a non-empty string. Received: ${color}`,
|
|
@@ -400,6 +425,7 @@ class TinyAnalogClock {
|
|
|
400
425
|
* @returns {string}
|
|
401
426
|
*/
|
|
402
427
|
get borderColor() {
|
|
428
|
+
checkDestroy(this.#destroyed);
|
|
403
429
|
return this.#config.borderColor;
|
|
404
430
|
}
|
|
405
431
|
|
|
@@ -409,6 +435,7 @@ class TinyAnalogClock {
|
|
|
409
435
|
* @throws {Error} If value is not a non-empty string.
|
|
410
436
|
*/
|
|
411
437
|
set markColor(color) {
|
|
438
|
+
checkDestroy(this.#destroyed);
|
|
412
439
|
if (typeof color !== 'string' || color.trim() === '') {
|
|
413
440
|
throw new Error(
|
|
414
441
|
`TinyAnalogClock: 'markColor' must be a non-empty string. Received: ${color}`,
|
|
@@ -424,6 +451,7 @@ class TinyAnalogClock {
|
|
|
424
451
|
* @returns {string}
|
|
425
452
|
*/
|
|
426
453
|
get markColor() {
|
|
454
|
+
checkDestroy(this.#destroyed);
|
|
427
455
|
return this.#config.markColor;
|
|
428
456
|
}
|
|
429
457
|
|
|
@@ -433,6 +461,7 @@ class TinyAnalogClock {
|
|
|
433
461
|
* @throws {Error} If value is not a non-empty string.
|
|
434
462
|
*/
|
|
435
463
|
set textColor(color) {
|
|
464
|
+
checkDestroy(this.#destroyed);
|
|
436
465
|
if (typeof color !== 'string' || color.trim() === '') {
|
|
437
466
|
throw new Error(
|
|
438
467
|
`TinyAnalogClock: 'textColor' must be a non-empty string. Received: ${color}`,
|
|
@@ -448,6 +477,7 @@ class TinyAnalogClock {
|
|
|
448
477
|
* @returns {string}
|
|
449
478
|
*/
|
|
450
479
|
get textColor() {
|
|
480
|
+
checkDestroy(this.#destroyed);
|
|
451
481
|
return this.#config.textColor;
|
|
452
482
|
}
|
|
453
483
|
|
|
@@ -457,6 +487,7 @@ class TinyAnalogClock {
|
|
|
457
487
|
* @throws {Error} If value is not a boolean.
|
|
458
488
|
*/
|
|
459
489
|
set showNumbers(value) {
|
|
490
|
+
checkDestroy(this.#destroyed);
|
|
460
491
|
if (typeof value !== 'boolean') {
|
|
461
492
|
throw new Error(
|
|
462
493
|
`TinyAnalogClock: 'showNumbers' must be a boolean. Received type: ${typeof value}`,
|
|
@@ -471,6 +502,7 @@ class TinyAnalogClock {
|
|
|
471
502
|
* @returns {boolean}
|
|
472
503
|
*/
|
|
473
504
|
get showNumbers() {
|
|
505
|
+
checkDestroy(this.#destroyed);
|
|
474
506
|
return this.#config.showNumbers;
|
|
475
507
|
}
|
|
476
508
|
|
|
@@ -479,6 +511,7 @@ class TinyAnalogClock {
|
|
|
479
511
|
* @param {string} value
|
|
480
512
|
*/
|
|
481
513
|
set bgColor(value) {
|
|
514
|
+
checkDestroy(this.#destroyed);
|
|
482
515
|
if (typeof value !== 'string' || !value)
|
|
483
516
|
throw new Error("TinyAnalogClock: 'bgColor' must be a non-empty string.");
|
|
484
517
|
this.#config.bgColor = value;
|
|
@@ -490,6 +523,7 @@ class TinyAnalogClock {
|
|
|
490
523
|
* @returns {string}
|
|
491
524
|
*/
|
|
492
525
|
get bgColor() {
|
|
526
|
+
checkDestroy(this.#destroyed);
|
|
493
527
|
return this.#config.bgColor;
|
|
494
528
|
}
|
|
495
529
|
|
|
@@ -498,6 +532,7 @@ class TinyAnalogClock {
|
|
|
498
532
|
* @param {number} value
|
|
499
533
|
*/
|
|
500
534
|
set borderWidth(value) {
|
|
535
|
+
checkDestroy(this.#destroyed);
|
|
501
536
|
if (typeof value !== 'number' || value < 0)
|
|
502
537
|
throw new Error("TinyAnalogClock: 'borderWidth' must be a non-negative number.");
|
|
503
538
|
this.#config.borderWidth = value;
|
|
@@ -510,6 +545,7 @@ class TinyAnalogClock {
|
|
|
510
545
|
* @returns {number}
|
|
511
546
|
*/
|
|
512
547
|
get borderWidth() {
|
|
548
|
+
checkDestroy(this.#destroyed);
|
|
513
549
|
return this.#config.borderWidth;
|
|
514
550
|
}
|
|
515
551
|
|
|
@@ -518,6 +554,7 @@ class TinyAnalogClock {
|
|
|
518
554
|
* @param {string} value
|
|
519
555
|
*/
|
|
520
556
|
set hourHandColor(value) {
|
|
557
|
+
checkDestroy(this.#destroyed);
|
|
521
558
|
if (typeof value !== 'string' || !value)
|
|
522
559
|
throw new Error("TinyAnalogClock: 'hourHandColor' must be a non-empty string.");
|
|
523
560
|
this.#config.hourHandColor = value;
|
|
@@ -529,6 +566,7 @@ class TinyAnalogClock {
|
|
|
529
566
|
* @returns {string}
|
|
530
567
|
*/
|
|
531
568
|
get hourHandColor() {
|
|
569
|
+
checkDestroy(this.#destroyed);
|
|
532
570
|
return this.#config.hourHandColor;
|
|
533
571
|
}
|
|
534
572
|
|
|
@@ -537,6 +575,7 @@ class TinyAnalogClock {
|
|
|
537
575
|
* @param {string} value
|
|
538
576
|
*/
|
|
539
577
|
set minuteHandColor(value) {
|
|
578
|
+
checkDestroy(this.#destroyed);
|
|
540
579
|
if (typeof value !== 'string' || !value)
|
|
541
580
|
throw new Error("TinyAnalogClock: 'minuteHandColor' must be a non-empty string.");
|
|
542
581
|
this.#config.minuteHandColor = value;
|
|
@@ -548,6 +587,7 @@ class TinyAnalogClock {
|
|
|
548
587
|
* @returns {string}
|
|
549
588
|
*/
|
|
550
589
|
get minuteHandColor() {
|
|
590
|
+
checkDestroy(this.#destroyed);
|
|
551
591
|
return this.#config.minuteHandColor;
|
|
552
592
|
}
|
|
553
593
|
|
|
@@ -556,6 +596,7 @@ class TinyAnalogClock {
|
|
|
556
596
|
* @param {string} value
|
|
557
597
|
*/
|
|
558
598
|
set secondHandColor(value) {
|
|
599
|
+
checkDestroy(this.#destroyed);
|
|
559
600
|
if (typeof value !== 'string' || !value)
|
|
560
601
|
throw new Error("TinyAnalogClock: 'secondHandColor' must be a non-empty string.");
|
|
561
602
|
this.#config.secondHandColor = value;
|
|
@@ -567,6 +608,7 @@ class TinyAnalogClock {
|
|
|
567
608
|
* @returns {string}
|
|
568
609
|
*/
|
|
569
610
|
get secondHandColor() {
|
|
611
|
+
checkDestroy(this.#destroyed);
|
|
570
612
|
return this.#config.secondHandColor;
|
|
571
613
|
}
|
|
572
614
|
|
|
@@ -575,6 +617,7 @@ class TinyAnalogClock {
|
|
|
575
617
|
* @param {boolean} value
|
|
576
618
|
*/
|
|
577
619
|
set showSeconds(value) {
|
|
620
|
+
checkDestroy(this.#destroyed);
|
|
578
621
|
if (typeof value !== 'boolean')
|
|
579
622
|
throw new Error("TinyAnalogClock: 'showSeconds' must be a boolean.");
|
|
580
623
|
this.#config.showSeconds = value;
|
|
@@ -586,6 +629,7 @@ class TinyAnalogClock {
|
|
|
586
629
|
* @returns {boolean}
|
|
587
630
|
*/
|
|
588
631
|
get showSeconds() {
|
|
632
|
+
checkDestroy(this.#destroyed);
|
|
589
633
|
return this.#config.showSeconds;
|
|
590
634
|
}
|
|
591
635
|
|
|
@@ -594,6 +638,7 @@ class TinyAnalogClock {
|
|
|
594
638
|
* @param {number} value - Positive number.
|
|
595
639
|
*/
|
|
596
640
|
set sizeAdjust(value) {
|
|
641
|
+
checkDestroy(this.#destroyed);
|
|
597
642
|
if (typeof value !== 'number' || value <= 0)
|
|
598
643
|
throw new Error("TinyAnalogClock: 'sizeAdjust' must be a positive number.");
|
|
599
644
|
this.#config.sizeAdjust = value;
|
|
@@ -605,6 +650,7 @@ class TinyAnalogClock {
|
|
|
605
650
|
* @returns {number}
|
|
606
651
|
*/
|
|
607
652
|
get sizeAdjust() {
|
|
653
|
+
checkDestroy(this.#destroyed);
|
|
608
654
|
return this.#config.sizeAdjust;
|
|
609
655
|
}
|
|
610
656
|
|
|
@@ -613,6 +659,7 @@ class TinyAnalogClock {
|
|
|
613
659
|
* @param {number} value - Non-negative number in pixels.
|
|
614
660
|
*/
|
|
615
661
|
set padding(value) {
|
|
662
|
+
checkDestroy(this.#destroyed);
|
|
616
663
|
if (typeof value !== 'number' || value < 0)
|
|
617
664
|
throw new Error("TinyAnalogClock: 'padding' must be a non-negative number.");
|
|
618
665
|
this.#config.padding = value;
|
|
@@ -624,6 +671,7 @@ class TinyAnalogClock {
|
|
|
624
671
|
* @returns {number}
|
|
625
672
|
*/
|
|
626
673
|
get padding() {
|
|
674
|
+
checkDestroy(this.#destroyed);
|
|
627
675
|
return this.#config.padding;
|
|
628
676
|
}
|
|
629
677
|
|
|
@@ -632,6 +680,7 @@ class TinyAnalogClock {
|
|
|
632
680
|
* @param {number} value - Positive number.
|
|
633
681
|
*/
|
|
634
682
|
set angleDistance(value) {
|
|
683
|
+
checkDestroy(this.#destroyed);
|
|
635
684
|
if (typeof value !== 'number' || value <= 0)
|
|
636
685
|
throw new Error("TinyAnalogClock: 'angleDistance' must be a positive number.");
|
|
637
686
|
this.#config.angleDistance = value;
|
|
@@ -643,6 +692,7 @@ class TinyAnalogClock {
|
|
|
643
692
|
* @returns {number}
|
|
644
693
|
*/
|
|
645
694
|
get angleDistance() {
|
|
695
|
+
checkDestroy(this.#destroyed);
|
|
646
696
|
return this.#config.angleDistance;
|
|
647
697
|
}
|
|
648
698
|
|
|
@@ -651,6 +701,7 @@ class TinyAnalogClock {
|
|
|
651
701
|
* @param {number} value - Positive number.
|
|
652
702
|
*/
|
|
653
703
|
set pwH(value) {
|
|
704
|
+
checkDestroy(this.#destroyed);
|
|
654
705
|
if (typeof value !== 'number' || value <= 0)
|
|
655
706
|
throw new Error("TinyAnalogClock: 'pwH' must be a positive number.");
|
|
656
707
|
this.#config.pwH = value;
|
|
@@ -662,6 +713,7 @@ class TinyAnalogClock {
|
|
|
662
713
|
* @returns {number}
|
|
663
714
|
*/
|
|
664
715
|
get pwH() {
|
|
716
|
+
checkDestroy(this.#destroyed);
|
|
665
717
|
return this.#config.pwH;
|
|
666
718
|
}
|
|
667
719
|
|
|
@@ -670,6 +722,7 @@ class TinyAnalogClock {
|
|
|
670
722
|
* @param {number} value - Positive number.
|
|
671
723
|
*/
|
|
672
724
|
set phH(value) {
|
|
725
|
+
checkDestroy(this.#destroyed);
|
|
673
726
|
if (typeof value !== 'number' || value <= 0)
|
|
674
727
|
throw new Error("TinyAnalogClock: 'phH' must be a positive number.");
|
|
675
728
|
this.#config.phH = value;
|
|
@@ -681,6 +734,7 @@ class TinyAnalogClock {
|
|
|
681
734
|
* @returns {number}
|
|
682
735
|
*/
|
|
683
736
|
get phH() {
|
|
737
|
+
checkDestroy(this.#destroyed);
|
|
684
738
|
return this.#config.phH;
|
|
685
739
|
}
|
|
686
740
|
|
|
@@ -689,6 +743,7 @@ class TinyAnalogClock {
|
|
|
689
743
|
* @param {number} value - Positive number.
|
|
690
744
|
*/
|
|
691
745
|
set pwM(value) {
|
|
746
|
+
checkDestroy(this.#destroyed);
|
|
692
747
|
if (typeof value !== 'number' || value <= 0)
|
|
693
748
|
throw new Error("TinyAnalogClock: 'pwM' must be a positive number.");
|
|
694
749
|
this.#config.pwM = value;
|
|
@@ -700,6 +755,7 @@ class TinyAnalogClock {
|
|
|
700
755
|
* @returns {number}
|
|
701
756
|
*/
|
|
702
757
|
get pwM() {
|
|
758
|
+
checkDestroy(this.#destroyed);
|
|
703
759
|
return this.#config.pwM;
|
|
704
760
|
}
|
|
705
761
|
|
|
@@ -708,6 +764,7 @@ class TinyAnalogClock {
|
|
|
708
764
|
* @param {number} value - Positive number.
|
|
709
765
|
*/
|
|
710
766
|
set phM(value) {
|
|
767
|
+
checkDestroy(this.#destroyed);
|
|
711
768
|
if (typeof value !== 'number' || value <= 0)
|
|
712
769
|
throw new Error("TinyAnalogClock: 'phM' must be a positive number.");
|
|
713
770
|
this.#config.phM = value;
|
|
@@ -719,6 +776,7 @@ class TinyAnalogClock {
|
|
|
719
776
|
* @returns {number}
|
|
720
777
|
*/
|
|
721
778
|
get phM() {
|
|
779
|
+
checkDestroy(this.#destroyed);
|
|
722
780
|
return this.#config.phM;
|
|
723
781
|
}
|
|
724
782
|
|
|
@@ -727,11 +785,13 @@ class TinyAnalogClock {
|
|
|
727
785
|
* @returns {void}
|
|
728
786
|
*/
|
|
729
787
|
destroy() {
|
|
788
|
+
if (this.#destroyed) return;
|
|
730
789
|
if (this.#animationFrame) {
|
|
731
790
|
cancelAnimationFrame(this.#animationFrame);
|
|
732
791
|
this.#animationFrame = null;
|
|
733
792
|
}
|
|
734
793
|
this.#element.remove();
|
|
794
|
+
this.#destroyed = true;
|
|
735
795
|
}
|
|
736
796
|
}
|
|
737
797
|
|
|
@@ -110,6 +110,12 @@ declare class TinyAnalogClock {
|
|
|
110
110
|
* @param {Partial<ClockConfig>} [options] - Optional configuration overrides.
|
|
111
111
|
*/
|
|
112
112
|
constructor(options?: Partial<ClockConfig>);
|
|
113
|
+
/**
|
|
114
|
+
* Gets the current destruction status of the instance.
|
|
115
|
+
*
|
|
116
|
+
* @returns {boolean} True if the instance is destroyed, false otherwise.
|
|
117
|
+
*/
|
|
118
|
+
get destroyed(): boolean;
|
|
113
119
|
/**
|
|
114
120
|
* Retrieves the current date and extracts the specific hour, minute, and second components.
|
|
115
121
|
* @returns {{ now: Date, s: number, m: number, h: number }}
|