@kizmann/pico-js 2.0.7 → 2.0.9
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/pico-js.browser.js +1 -1
- package/dist/pico-js.browser.js.map +1 -1
- package/dist/pico-js.esm.js +1 -1
- package/dist/pico-js.esm.js.map +1 -1
- package/package.json +4 -6
- package/src/dom/{DomAttribute.js → DomAttribute.ts} +40 -63
- package/src/dom/{DomBuilder.js → DomBuilder.ts} +27 -44
- package/src/dom/{DomEvent.js → DomEvent.ts} +101 -76
- package/src/dom/{DomFinder.js → DomFinder.ts} +103 -139
- package/src/dom/DomForm.ts +38 -0
- package/src/dom/{DomGlobal.js → DomGlobal.ts} +34 -51
- package/src/dom/{DomInview.js → DomInview.ts} +37 -57
- package/src/dom/DomMeta.ts +48 -0
- package/src/dom/DomObserver.ts +17 -0
- package/src/dom/{DomPopover.js → DomPopover.ts} +20 -39
- package/src/dom/{DomRectangle.js → DomRectangle.ts} +70 -87
- package/src/format/{FormatFile.js → FormatFile.ts} +12 -23
- package/src/format/{FormatOption.js → FormatOption.ts} +15 -24
- package/src/format/{FormatParam.js → FormatParam.ts} +14 -25
- package/src/format/{FormatParser.js → FormatParser.ts} +29 -39
- package/src/format/{FormatUrl.js → FormatUrl.ts} +9 -21
- package/src/index.browser.ts +32 -0
- package/src/index.esm.ts +64 -0
- package/src/now/{NowDefault.js → NowDefault.ts} +86 -121
- package/src/now/{NowFormat.js → NowFormat.ts} +23 -28
- package/src/now/{NowGrid.js → NowGrid.ts} +41 -58
- package/src/now/{NowHuman.js → NowHuman.ts} +18 -27
- package/src/now/{NowMatch.js → NowMatch.ts} +22 -28
- package/src/now/{NowRange.js → NowRange.ts} +13 -22
- package/src/now/{NowWalker.js → NowWalker.ts} +65 -71
- package/src/tool/{scope.js → scope.ts} +41 -11
- package/src/utils/{Array.js → Array.ts} +187 -152
- package/src/utils/{Cookie.js → Cookie.ts} +15 -12
- package/src/utils/{Data.js → Data.ts} +17 -17
- package/src/utils/Dom.ts +204 -0
- package/src/utils/Format.ts +48 -0
- package/src/utils/{Hash.js → Hash.ts} +20 -20
- package/src/utils/{Locale.js → Locale.ts} +21 -21
- package/src/utils/{Mixed.js → Mixed.ts} +104 -61
- package/src/utils/{Now.js → Now.ts} +68 -69
- package/src/utils/{Number.js → Number.ts} +34 -36
- package/src/utils/{Object.js → Object.ts} +68 -122
- package/src/utils/{Route.js → Route.ts} +11 -9
- package/src/utils/{Runner.js → Runner.ts} +89 -77
- package/src/utils/{Signal.js → Signal.ts} +35 -22
- package/src/utils/{String.js → String.ts} +79 -69
- package/src/wip/{Element.js → Element.ts} +2 -2
- package/src/wip/{Map.js → Map.ts} +1 -1
- package/types/dom/DomAttribute.d.ts +16 -27
- package/types/dom/DomBuilder.d.ts +6 -9
- package/types/dom/DomEvent.d.ts +19 -24
- package/types/dom/DomFinder.d.ts +38 -61
- package/types/dom/DomForm.d.ts +7 -10
- package/types/dom/DomGlobal.d.ts +8 -15
- package/types/dom/DomInview.d.ts +9 -19
- package/types/dom/DomMeta.d.ts +9 -16
- package/types/dom/DomObserver.d.ts +4 -8
- package/types/dom/DomPopover.d.ts +8 -11
- package/types/dom/DomRectangle.d.ts +21 -35
- package/types/format/FormatFile.d.ts +5 -8
- package/types/format/FormatOption.d.ts +6 -8
- package/types/format/FormatParam.d.ts +6 -9
- package/types/format/FormatParser.d.ts +10 -18
- package/types/format/FormatUrl.d.ts +5 -8
- package/types/index.esm.d.ts +25 -37
- package/types/now/NowDefault.d.ts +30 -99
- package/types/now/NowFormat.d.ts +8 -21
- package/types/now/NowGrid.d.ts +24 -46
- package/types/now/NowHuman.d.ts +10 -11
- package/types/now/NowMatch.d.ts +6 -4
- package/types/now/NowRange.d.ts +5 -8
- package/types/now/NowWalker.d.ts +6 -4
- package/types/tool/scope.d.ts +11 -3
- package/types/utils/Array.d.ts +83 -101
- package/types/utils/Cookie.d.ts +11 -8
- package/types/utils/Data.d.ts +7 -7
- package/types/utils/Dom.d.ts +63 -96
- package/types/utils/Format.d.ts +15 -28
- package/types/utils/Hash.d.ts +21 -21
- package/types/utils/Locale.d.ts +9 -9
- package/types/utils/Mixed.d.ts +19 -32
- package/types/utils/Now.d.ts +51 -56
- package/types/utils/Number.d.ts +9 -20
- package/types/utils/Object.d.ts +21 -36
- package/types/utils/Route.d.ts +5 -2
- package/types/utils/Runner.d.ts +45 -38
- package/types/utils/Signal.d.ts +16 -16
- package/types/utils/String.d.ts +40 -76
- package/src/dom/DomForm.js +0 -59
- package/src/dom/DomMeta.js +0 -68
- package/src/dom/DomObserver.js +0 -38
- package/src/index.browser.js +0 -36
- package/src/index.esm.js +0 -80
- package/src/utils/Dom.js +0 -214
- package/src/utils/Format.js +0 -62
- package/types/wip/Element.d.ts +0 -119
- package/types/wip/Map.d.ts +0 -254
|
@@ -1,12 +1,39 @@
|
|
|
1
|
-
import { Arr,
|
|
1
|
+
import { Arr, Mix, Obj } from "../index.esm.ts";
|
|
2
2
|
|
|
3
3
|
export class PicoRunner
|
|
4
4
|
{
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @type {any}
|
|
7
|
+
*/
|
|
8
|
+
static $idler : any = null;
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
static $timer : number = 0;
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
/**
|
|
16
|
+
* @type {any[]}
|
|
17
|
+
*/
|
|
18
|
+
static $buffer : any[] = [];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Run interval and return clear function
|
|
22
|
+
*
|
|
23
|
+
* @example Run.interval(cb, 100)
|
|
24
|
+
*
|
|
25
|
+
* @param {Function} fn Callback function
|
|
26
|
+
* @param {number} [intval] Callback interval
|
|
27
|
+
* @returns {Function} Noop clear function
|
|
28
|
+
*/
|
|
29
|
+
static interval(fn : Function, intval : number = 0) : Function
|
|
30
|
+
{
|
|
31
|
+
const idle = setInterval(() => {
|
|
32
|
+
fn();
|
|
33
|
+
}, intval);
|
|
34
|
+
|
|
35
|
+
return () => clearInterval(idle);
|
|
36
|
+
}
|
|
10
37
|
|
|
11
38
|
/**
|
|
12
39
|
* Clear timer or call function
|
|
@@ -14,12 +41,12 @@ export class PicoRunner
|
|
|
14
41
|
* @example Run.clear(timer)
|
|
15
42
|
*
|
|
16
43
|
* @param {any} timer Timer ID, array of IDs, or function
|
|
17
|
-
* @returns {
|
|
44
|
+
* @returns {PicoRunner} Static class
|
|
18
45
|
*/
|
|
19
|
-
static clear(timer)
|
|
46
|
+
static clear(timer : any) : PicoRunner
|
|
20
47
|
{
|
|
21
48
|
if ( Mix.isArr(timer) ) {
|
|
22
|
-
return Arr.each(timer, (t) => this.clear(t), this);
|
|
49
|
+
return Arr.each(timer, (t : any) => this.clear(t), this);
|
|
23
50
|
}
|
|
24
51
|
|
|
25
52
|
if ( Mix.isFunc(timer) ) {
|
|
@@ -35,13 +62,13 @@ export class PicoRunner
|
|
|
35
62
|
/**
|
|
36
63
|
* Request idle callback with fallback
|
|
37
64
|
*
|
|
38
|
-
* @param {
|
|
39
|
-
* @returns {
|
|
65
|
+
* @param {Function} cb Callback function
|
|
66
|
+
* @returns {PicoRunner} Static class
|
|
40
67
|
*/
|
|
41
|
-
static tryin(cb)
|
|
68
|
+
static tryin(cb : Function) : PicoRunner
|
|
42
69
|
{
|
|
43
70
|
try {
|
|
44
|
-
|
|
71
|
+
cb();
|
|
45
72
|
} catch (e) {
|
|
46
73
|
//
|
|
47
74
|
}
|
|
@@ -57,11 +84,11 @@ export class PicoRunner
|
|
|
57
84
|
* @param {function} fn Condition function
|
|
58
85
|
* @param {number} [intval] Interval ms
|
|
59
86
|
* @param {number} [limit] Max iterations
|
|
60
|
-
* @returns {
|
|
87
|
+
* @returns {Function} Clear function
|
|
61
88
|
*/
|
|
62
|
-
static wait(fn, intval = 0, limit = 500)
|
|
89
|
+
static wait(fn : Function, intval : number = 0, limit : number = 500) : Function
|
|
63
90
|
{
|
|
64
|
-
let idler, timer;
|
|
91
|
+
let idler : any, timer : any;
|
|
65
92
|
|
|
66
93
|
timer = setTimeout(() => {
|
|
67
94
|
this.clear([idler, timer]);
|
|
@@ -79,35 +106,16 @@ export class PicoRunner
|
|
|
79
106
|
*
|
|
80
107
|
* @example Run.frame(cb)
|
|
81
108
|
*
|
|
82
|
-
* @param {
|
|
83
|
-
* @
|
|
84
|
-
* @returns {function} Noop clear function
|
|
109
|
+
* @param {Function} fn Callback function
|
|
110
|
+
* @returns {Function} Noop clear function
|
|
85
111
|
*/
|
|
86
|
-
static frame(fn
|
|
112
|
+
static frame(fn : Function) : Function
|
|
87
113
|
{
|
|
88
|
-
requestAnimationFrame(() => {
|
|
89
|
-
fn(
|
|
114
|
+
const frame = requestAnimationFrame(() => {
|
|
115
|
+
fn();
|
|
90
116
|
});
|
|
91
117
|
|
|
92
|
-
return () =>
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Run function when browser is idle
|
|
97
|
-
*
|
|
98
|
-
* @example Run.idle(cb)
|
|
99
|
-
*
|
|
100
|
-
* @param {function} fn Callback function
|
|
101
|
-
* @param {any} [...args] Callback arguments
|
|
102
|
-
* @returns {function} Noop clear function
|
|
103
|
-
*/
|
|
104
|
-
static idle(fn, ...args)
|
|
105
|
-
{
|
|
106
|
-
requestIdleCallback(() => {
|
|
107
|
-
fn(...args)
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
return () => null;
|
|
118
|
+
return () => cancelAnimationFrame(frame);
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
/**
|
|
@@ -115,17 +123,16 @@ export class PicoRunner
|
|
|
115
123
|
*
|
|
116
124
|
* @example Run.async(cb)
|
|
117
125
|
*
|
|
118
|
-
* @param {
|
|
119
|
-
* @
|
|
120
|
-
* @returns {function} Noop clear function
|
|
126
|
+
* @param {Function} fn Callback function
|
|
127
|
+
* @returns {Function} Noop clear function
|
|
121
128
|
*/
|
|
122
|
-
static async(fn
|
|
129
|
+
static async(fn : Function) : Function
|
|
123
130
|
{
|
|
124
|
-
setTimeout(() => {
|
|
125
|
-
fn(
|
|
131
|
+
const idle = setTimeout(() => {
|
|
132
|
+
fn()
|
|
126
133
|
});
|
|
127
134
|
|
|
128
|
-
return () =>
|
|
135
|
+
return () => clearTimeout(idle);
|
|
129
136
|
}
|
|
130
137
|
|
|
131
138
|
/**
|
|
@@ -133,15 +140,14 @@ export class PicoRunner
|
|
|
133
140
|
*
|
|
134
141
|
* @example Run.delay(cb, 100)
|
|
135
142
|
*
|
|
136
|
-
* @param {
|
|
143
|
+
* @param {Function} fn Callback function
|
|
137
144
|
* @param {number} [delay] Delay ms
|
|
138
|
-
* @
|
|
139
|
-
* @returns {function} Clear function
|
|
145
|
+
* @returns {Function} Clear function
|
|
140
146
|
*/
|
|
141
|
-
static delay(fn, delay = 0
|
|
147
|
+
static delay(fn : Function, delay : number = 0) : Function
|
|
142
148
|
{
|
|
143
149
|
let idler = setTimeout(() => {
|
|
144
|
-
fn(
|
|
150
|
+
fn();
|
|
145
151
|
}, delay);
|
|
146
152
|
|
|
147
153
|
return () => clearTimeout(idler);
|
|
@@ -152,22 +158,22 @@ export class PicoRunner
|
|
|
152
158
|
*
|
|
153
159
|
* @example const fn = Run.debounce(cb, 100)
|
|
154
160
|
*
|
|
155
|
-
* @param {
|
|
161
|
+
* @param {Function} cb Callback to run
|
|
156
162
|
* @param {number} [timeout] Wait ms
|
|
157
|
-
* @returns {
|
|
163
|
+
* @returns {Function} Debounced fn
|
|
158
164
|
*/
|
|
159
|
-
static debounce(cb, timeout = 100)
|
|
165
|
+
static debounce(cb : Function, timeout : number = 100) : Function
|
|
160
166
|
{
|
|
161
167
|
let idler = null;
|
|
162
168
|
|
|
163
|
-
return (...args) => {
|
|
169
|
+
return (...args : any[]) => {
|
|
164
170
|
|
|
165
171
|
if ( idler ) {
|
|
166
172
|
clearTimeout(idler);
|
|
167
173
|
}
|
|
168
174
|
|
|
169
175
|
idler = setTimeout(() => {
|
|
170
|
-
this.frame(cb
|
|
176
|
+
this.frame(() => cb(...args));
|
|
171
177
|
}, timeout);
|
|
172
178
|
};
|
|
173
179
|
}
|
|
@@ -177,15 +183,15 @@ export class PicoRunner
|
|
|
177
183
|
*
|
|
178
184
|
* @example const fn = Run.throttle(cb, 100)
|
|
179
185
|
*
|
|
180
|
-
* @param {
|
|
186
|
+
* @param {Function} cb Callback to run
|
|
181
187
|
* @param {number} [timeout] Wait ms
|
|
182
|
-
* @returns {
|
|
188
|
+
* @returns {Function} Throttled fn
|
|
183
189
|
*/
|
|
184
|
-
static throttle(cb, timeout = 100)
|
|
190
|
+
static throttle(cb : Function, timeout : number = 100) : Function
|
|
185
191
|
{
|
|
186
|
-
let queued, idler = null;
|
|
192
|
+
let queued : any, idler : any = null;
|
|
187
193
|
|
|
188
|
-
return (...args) => {
|
|
194
|
+
return (...args : any[]) => {
|
|
189
195
|
|
|
190
196
|
if ( idler ) {
|
|
191
197
|
clearTimeout(idler);
|
|
@@ -199,7 +205,7 @@ export class PicoRunner
|
|
|
199
205
|
return;
|
|
200
206
|
}
|
|
201
207
|
|
|
202
|
-
(this.frame(cb
|
|
208
|
+
(this.frame(() => cb(...args)), queued = true);
|
|
203
209
|
};
|
|
204
210
|
}
|
|
205
211
|
|
|
@@ -208,22 +214,27 @@ export class PicoRunner
|
|
|
208
214
|
*
|
|
209
215
|
* @example const fn = Run.framerate(cb, 30)
|
|
210
216
|
*
|
|
211
|
-
* @param {
|
|
217
|
+
* @param {Function} cb Callback to run
|
|
212
218
|
* @param {number} [fps] Max frames per sec
|
|
213
|
-
* @
|
|
219
|
+
* @param {boolean} [finish] Finish last frame
|
|
220
|
+
* @returns {Function} Rate-limited fn
|
|
214
221
|
*/
|
|
215
|
-
static framerate(cb, fps = 30)
|
|
222
|
+
static framerate(cb : Function, fps : number = 30, finish : boolean = true) : Function
|
|
216
223
|
{
|
|
217
|
-
let last = 0;
|
|
224
|
+
let timer : any, last = 0, hertz = 1000 / fps;
|
|
218
225
|
|
|
219
|
-
|
|
226
|
+
const fn = (...args : any) => {
|
|
220
227
|
|
|
221
|
-
|
|
222
|
-
|
|
228
|
+
clearTimeout(timer);
|
|
229
|
+
|
|
230
|
+
if ( Date.now() - last <= hertz ) {
|
|
231
|
+
return finish && (timer = setTimeout(fn, hertz + 1));
|
|
223
232
|
}
|
|
224
233
|
|
|
225
|
-
(this.frame(cb
|
|
234
|
+
(this.frame(() => cb(...args)), last = Date.now());
|
|
226
235
|
};
|
|
236
|
+
|
|
237
|
+
return fn;
|
|
227
238
|
}
|
|
228
239
|
|
|
229
240
|
/**
|
|
@@ -231,12 +242,12 @@ export class PicoRunner
|
|
|
231
242
|
*
|
|
232
243
|
* @example el.onwheel = Run.framebuffer(cb,"wheel")
|
|
233
244
|
*
|
|
234
|
-
* @param {
|
|
245
|
+
* @param {Function} cb Callback to run
|
|
235
246
|
* @param {string} key Buffer key
|
|
236
247
|
* @param {number} [priority] Sort priority
|
|
237
|
-
* @returns {
|
|
248
|
+
* @returns {Function} Buffered handler
|
|
238
249
|
*/
|
|
239
|
-
static framebuffer(cb, key, priority = 1000)
|
|
250
|
+
static framebuffer(cb : Function, key : string, priority : number = 1000) : Function
|
|
240
251
|
{
|
|
241
252
|
const item = {
|
|
242
253
|
key, cb, priority, args: [], active: false
|
|
@@ -244,7 +255,7 @@ export class PicoRunner
|
|
|
244
255
|
|
|
245
256
|
Arr.add(this.$buffer, item);
|
|
246
257
|
|
|
247
|
-
return (e, ...args) => {
|
|
258
|
+
return (e : any, ...args : any) => {
|
|
248
259
|
|
|
249
260
|
if ( /^drag/.test(e.type) ) {
|
|
250
261
|
e.preventDefault();
|
|
@@ -265,7 +276,7 @@ export class PicoRunner
|
|
|
265
276
|
*
|
|
266
277
|
* @returns {void} No return value
|
|
267
278
|
*/
|
|
268
|
-
static runFramebuffer()
|
|
279
|
+
static runFramebuffer() : void
|
|
269
280
|
{
|
|
270
281
|
if ( this.$idler ) {
|
|
271
282
|
clearTimeout(this.$idler);
|
|
@@ -295,8 +306,9 @@ export class PicoRunner
|
|
|
295
306
|
|
|
296
307
|
buffer = Arr.sort(buffer, 'priority');
|
|
297
308
|
|
|
298
|
-
Arr.each(buffer.reverse(), (item) => {
|
|
299
|
-
item.cb(...item.args);
|
|
309
|
+
Arr.each(buffer.reverse(), (item : any) => {
|
|
310
|
+
item.cb(...item.args);
|
|
311
|
+
item.active = false;
|
|
300
312
|
});
|
|
301
313
|
}
|
|
302
314
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Str, Event, For, Mix, Arr } from "../index.esm.
|
|
1
|
+
import { Str, Event, For, Mix, Arr } from "../index.esm.ts";
|
|
2
2
|
|
|
3
3
|
export class PicoSignal
|
|
4
4
|
{
|
|
@@ -10,16 +10,21 @@ export class PicoSignal
|
|
|
10
10
|
* @example Event.bind("x", cb) // => Event
|
|
11
11
|
* @example Event.bind(["a","b"], cb) // => Event
|
|
12
12
|
*
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
13
|
+
* @param {string|string[]} event Event name(s)
|
|
14
|
+
* @param {Function} cb Event callback
|
|
15
15
|
* @param {any} [options] Listener options
|
|
16
16
|
* @param {boolean} [paused] Start paused
|
|
17
|
-
* @returns {
|
|
17
|
+
* @returns {PicoSignal} Event class
|
|
18
18
|
*/
|
|
19
|
-
static bind(event, cb, options = {}, paused = false)
|
|
19
|
+
static bind(event : string | string[], cb : Function, options : any = {}, paused : boolean = false) : PicoSignal
|
|
20
20
|
{
|
|
21
|
+
const args : any[] = [
|
|
22
|
+
cb, options, paused
|
|
23
|
+
];
|
|
24
|
+
|
|
21
25
|
if ( Mix.isArr(event) ) {
|
|
22
|
-
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
return Arr.each(event, (e : any) => this.bind(e, ...args), this);
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
if ( Mix.isPrim(options) ) {
|
|
@@ -39,14 +44,18 @@ export class PicoSignal
|
|
|
39
44
|
* @example Event.unbind("x") // => Event
|
|
40
45
|
* @example Event.unbind(["a","b"]) // => Event
|
|
41
46
|
*
|
|
42
|
-
* @param {
|
|
47
|
+
* @param {string|string[]} event Event name(s)
|
|
43
48
|
* @param {any} [options] Listener options
|
|
44
|
-
* @returns {
|
|
49
|
+
* @returns {PicoSignal} Event class
|
|
45
50
|
*/
|
|
46
|
-
static unbind(event, options = {})
|
|
51
|
+
static unbind(event : string | string[], options : any = {}) : PicoSignal
|
|
47
52
|
{
|
|
53
|
+
const args : any[] = [
|
|
54
|
+
options,
|
|
55
|
+
];
|
|
56
|
+
|
|
48
57
|
if ( Mix.isArr(event) ) {
|
|
49
|
-
return Arr.each(event, (e) => this.unbind(e, ...
|
|
58
|
+
return Arr.each(event, (e : any) => this.unbind(e, ...args), this);
|
|
50
59
|
}
|
|
51
60
|
|
|
52
61
|
if ( Mix.isPrim(options) ) {
|
|
@@ -67,16 +76,16 @@ export class PicoSignal
|
|
|
67
76
|
*
|
|
68
77
|
* @param {string} event Event name
|
|
69
78
|
* @param {...any} args Event args
|
|
70
|
-
* @returns {
|
|
79
|
+
* @returns {PicoSignal} Event class
|
|
71
80
|
*/
|
|
72
|
-
static fire(event, ...args)
|
|
81
|
+
static fire(event : string, ...args : Parameters<any>) : PicoSignal
|
|
73
82
|
{
|
|
74
83
|
let events = this.$events.filter((item) => {
|
|
75
84
|
return item.event === event;
|
|
76
85
|
});
|
|
77
86
|
|
|
78
|
-
Arr.each(events, (e) => {
|
|
79
|
-
if ( !
|
|
87
|
+
Arr.each(events, (e : any) => {
|
|
88
|
+
if ( !e.paused ) {
|
|
80
89
|
e.cb.call({}, ...args);
|
|
81
90
|
}
|
|
82
91
|
});
|
|
@@ -89,14 +98,18 @@ export class PicoSignal
|
|
|
89
98
|
*
|
|
90
99
|
* @example Event.pause("x") // => Event
|
|
91
100
|
*
|
|
92
|
-
* @param {
|
|
101
|
+
* @param {string|string[]} event Event name(s)
|
|
93
102
|
* @param {any} [options] Listener options
|
|
94
|
-
* @returns {
|
|
103
|
+
* @returns {PicoSignal} Event class
|
|
95
104
|
*/
|
|
96
|
-
static pause(event, options = {})
|
|
105
|
+
static pause(event : string | string[], options : any = {}) : PicoSignal
|
|
97
106
|
{
|
|
107
|
+
const args : any[] = [
|
|
108
|
+
options,
|
|
109
|
+
];
|
|
110
|
+
|
|
98
111
|
if ( Mix.isArr(event) ) {
|
|
99
|
-
return Arr.each(event, (e) => this.pause(e, ...
|
|
112
|
+
return Arr.each(event, (e : any) => this.pause(e, ...args), this);
|
|
100
113
|
}
|
|
101
114
|
|
|
102
115
|
let value = Arr.find(this.$events, {
|
|
@@ -115,14 +128,14 @@ export class PicoSignal
|
|
|
115
128
|
*
|
|
116
129
|
* @example Event.unpause("x") // => Event
|
|
117
130
|
*
|
|
118
|
-
* @param {
|
|
131
|
+
* @param {string|string[]} event Event name(s)
|
|
119
132
|
* @param {any} [options] Listener options
|
|
120
|
-
* @returns {
|
|
133
|
+
* @returns {PicoSignal} Event class
|
|
121
134
|
*/
|
|
122
|
-
static unpause(event, options = {})
|
|
135
|
+
static unpause(event : string | string[], options : any = {}) : PicoSignal
|
|
123
136
|
{
|
|
124
137
|
if ( Mix.isArr(event) ) {
|
|
125
|
-
return Arr.each(event, (e) => this.pause(e, ...arguments), this);
|
|
138
|
+
return Arr.each(event, (e : any) => this.pause(e, ...arguments), this);
|
|
126
139
|
}
|
|
127
140
|
|
|
128
141
|
let value = Arr.find(this.$events, {
|