@kizmann/pico-js 0.4.7 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/pico-js.js +1 -1
- package/dist/pico-js.js.map +1 -1
- package/package.json +1 -1
- package/src/utility/any.js +8 -0
- package/src/utility/now.js +10 -10
package/package.json
CHANGED
package/src/utility/any.js
CHANGED
@@ -226,8 +226,16 @@ export class Any
|
|
226
226
|
throttle = ref();
|
227
227
|
}
|
228
228
|
|
229
|
+
let timer = null;
|
230
|
+
|
229
231
|
return (...args) => {
|
230
232
|
|
233
|
+
clearTimeout(timer);
|
234
|
+
|
235
|
+
timer = setTimeout(() => {
|
236
|
+
throttle = null;
|
237
|
+
}, delay);
|
238
|
+
|
231
239
|
if ( throttle === true ) {
|
232
240
|
return;
|
233
241
|
}
|
package/src/utility/now.js
CHANGED
@@ -5,7 +5,7 @@ export class Now
|
|
5
5
|
initialDate = null;
|
6
6
|
moment = null;
|
7
7
|
|
8
|
-
constructor(date = null, format = 'YYYY-MM-DD
|
8
|
+
constructor(date = null, format = 'YYYY-MM-DD HH:mm:ss')
|
9
9
|
{
|
10
10
|
if ( ! global.moment ) {
|
11
11
|
throw new Error('Moment.js is required for pi.Now');
|
@@ -79,7 +79,7 @@ export class Now
|
|
79
79
|
return this;
|
80
80
|
}
|
81
81
|
|
82
|
-
static make(date = null, format = 'YYYY-MM-DD
|
82
|
+
static make(date = null, format = 'YYYY-MM-DD HH:mm:ss')
|
83
83
|
{
|
84
84
|
return new Now(date, format);
|
85
85
|
}
|
@@ -105,7 +105,7 @@ export class Now
|
|
105
105
|
return Num.int(this.format(format, true));
|
106
106
|
}
|
107
107
|
|
108
|
-
format(format = 'YYYY-MM-DD
|
108
|
+
format(format = 'YYYY-MM-DD HH:mm:ss', force = false)
|
109
109
|
{
|
110
110
|
if ( ! this.valid() && ! force ) {
|
111
111
|
return '';
|
@@ -127,8 +127,8 @@ export class Now
|
|
127
127
|
|
128
128
|
beforeTime(before = null)
|
129
129
|
{
|
130
|
-
return this.code('
|
131
|
-
Now.make(before).code('
|
130
|
+
return this.code('HHmmss') <
|
131
|
+
Now.make(before).code('HHmmss');
|
132
132
|
}
|
133
133
|
|
134
134
|
after(after = null)
|
@@ -144,8 +144,8 @@ export class Now
|
|
144
144
|
|
145
145
|
afterTime(after = null)
|
146
146
|
{
|
147
|
-
return this.code('
|
148
|
-
Now.make(after).code('
|
147
|
+
return this.code('HHmmss') >
|
148
|
+
Now.make(after).code('HHmmss');
|
149
149
|
}
|
150
150
|
|
151
151
|
equal(equal = null, format = 'X')
|
@@ -159,7 +159,7 @@ export class Now
|
|
159
159
|
return this.equal(equal, format);
|
160
160
|
}
|
161
161
|
|
162
|
-
equalTime(equal = null, format = '
|
162
|
+
equalTime(equal = null, format = 'HHmmss')
|
163
163
|
{
|
164
164
|
return this.equal(equal, format);
|
165
165
|
}
|
@@ -519,7 +519,7 @@ export class Now
|
|
519
519
|
return this;
|
520
520
|
}
|
521
521
|
|
522
|
-
applyDate(now, format = 'YYYY-MM-DD
|
522
|
+
applyDate(now, format = 'YYYY-MM-DD HH:mm:ss')
|
523
523
|
{
|
524
524
|
now = Now.make(now, format);
|
525
525
|
|
@@ -528,7 +528,7 @@ export class Now
|
|
528
528
|
this.date(now.date());
|
529
529
|
}
|
530
530
|
|
531
|
-
applyTime(now, format = 'YYYY-MM-DD
|
531
|
+
applyTime(now, format = 'YYYY-MM-DD HH:mm:ss')
|
532
532
|
{
|
533
533
|
now = Now.make(now, format);
|
534
534
|
|