@x-oasis/batchinator 0.0.11 → 0.0.13
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/batchinator.cjs.development.js +13 -2
- package/dist/batchinator.cjs.development.js.map +1 -1
- package/dist/batchinator.cjs.production.min.js +1 -1
- package/dist/batchinator.cjs.production.min.js.map +1 -1
- package/dist/batchinator.esm.js +13 -2
- package/dist/batchinator.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/index.ts +9 -0
|
@@ -29,11 +29,22 @@ var Batchinator = /*#__PURE__*/function () {
|
|
|
29
29
|
_proto.inSchedule = function inSchedule() {
|
|
30
30
|
return !!this._taskHandle;
|
|
31
31
|
};
|
|
32
|
-
_proto.
|
|
33
|
-
var _this = this;
|
|
32
|
+
_proto.flush = function flush() {
|
|
34
33
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35
34
|
args[_key] = arguments[_key];
|
|
36
35
|
}
|
|
36
|
+
if (args.length) this._args = args;
|
|
37
|
+
if (this._taskHandle) {
|
|
38
|
+
this._taskHandle.cancel();
|
|
39
|
+
this._taskHandle = null;
|
|
40
|
+
}
|
|
41
|
+
this._callback.apply(this, this._args);
|
|
42
|
+
};
|
|
43
|
+
_proto.schedule = function schedule() {
|
|
44
|
+
var _this = this;
|
|
45
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
46
|
+
args[_key2] = arguments[_key2];
|
|
47
|
+
}
|
|
37
48
|
this._args = args;
|
|
38
49
|
if (this._taskHandle) return;
|
|
39
50
|
var handler = function handler() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batchinator.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["// import { InteractionManager } from 'react-native';\n\n// https://github.com/facebook/react-native/blob/main/Libraries/Interaction/Batchinator.js\n\nclass Batchinator {\n readonly _delayMS: number;\n private _args: Array<any>;\n\n private _callback: Function;\n private _taskHandle: {\n cancel: () => void;\n };\n\n constructor(cb: Function, delayMS: number) {\n this._callback = cb;\n this._delayMS = delayMS;\n this._taskHandle = null;\n this._args = null;\n }\n\n dispose(\n options: {\n abort: boolean;\n } = {\n abort: false,\n }\n ) {\n const { abort } = options;\n if (this._taskHandle) {\n this._taskHandle.cancel();\n this._taskHandle = null;\n }\n if (typeof this._callback === 'function' && !abort) {\n this._callback.apply(this, this._args);\n }\n }\n\n inSchedule() {\n return !!this._taskHandle;\n }\n\n schedule(...args) {\n this._args = args;\n\n if (this._taskHandle) return;\n const handler = () => {\n Promise.resolve().then(() => {\n this._taskHandle = null;\n this._callback.apply(this, this._args);\n });\n };\n\n if (!this._delayMS) {\n handler();\n return;\n }\n\n const timeoutHandle = setTimeout(() => {\n handler();\n }, this._delayMS);\n\n this._taskHandle = { cancel: () => clearTimeout(timeoutHandle) };\n }\n}\n\nexport default Batchinator;\n"],"names":["Batchinator","cb","delayMS","_callback","_delayMS","_taskHandle","_args","_proto","prototype","dispose","options","abort","_options","cancel","apply","inSchedule","
|
|
1
|
+
{"version":3,"file":"batchinator.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["// import { InteractionManager } from 'react-native';\n\n// https://github.com/facebook/react-native/blob/main/Libraries/Interaction/Batchinator.js\n\nclass Batchinator {\n readonly _delayMS: number;\n private _args: Array<any>;\n\n private _callback: Function;\n private _taskHandle: {\n cancel: () => void;\n };\n\n constructor(cb: Function, delayMS: number) {\n this._callback = cb;\n this._delayMS = delayMS;\n this._taskHandle = null;\n this._args = null;\n }\n\n dispose(\n options: {\n abort: boolean;\n } = {\n abort: false,\n }\n ) {\n const { abort } = options;\n if (this._taskHandle) {\n this._taskHandle.cancel();\n this._taskHandle = null;\n }\n if (typeof this._callback === 'function' && !abort) {\n this._callback.apply(this, this._args);\n }\n }\n\n inSchedule() {\n return !!this._taskHandle;\n }\n\n flush(...args) {\n if (args.length) this._args = args;\n if (this._taskHandle) {\n this._taskHandle.cancel();\n this._taskHandle = null;\n }\n this._callback.apply(this, this._args);\n }\n\n schedule(...args) {\n this._args = args;\n\n if (this._taskHandle) return;\n const handler = () => {\n Promise.resolve().then(() => {\n this._taskHandle = null;\n this._callback.apply(this, this._args);\n });\n };\n\n if (!this._delayMS) {\n handler();\n return;\n }\n\n const timeoutHandle = setTimeout(() => {\n handler();\n }, this._delayMS);\n\n this._taskHandle = { cancel: () => clearTimeout(timeoutHandle) };\n }\n}\n\nexport default Batchinator;\n"],"names":["Batchinator","cb","delayMS","_callback","_delayMS","_taskHandle","_args","_proto","prototype","dispose","options","abort","_options","cancel","apply","inSchedule","flush","args","Array","_len","_key","arguments","length","schedule","_len2","_key2","handler","Promise","resolve","then","_this","timeoutHandle","setTimeout","clearTimeout"],"mappings":";;;;IAIMA,WAAW;EASf,SAAAA,YAAYC,EAAY,EAAEC,OAAe;IACvC,IAAI,CAACC,SAAS,GAAGF,EAAE;IACnB,IAAI,CAACG,QAAQ,GAAGF,OAAO;IACvB,IAAI,CAACG,WAAW,GAAG,IAAI;IACvB,IAAI,CAACC,KAAK,GAAG,IAAI;;EAClB,IAAAC,MAAA,GAAAP,WAAA,CAAAQ,SAAA;EAAAD,MAAA,CAEDE,OAAO,GAAP,SAAAA,QACEC;QAAAA;MAAAA,UAEI;QACFC,KAAK,EAAE;OACR;;IAED,IAAAC,QAAA,GAAkBF,OAAO;MAAjBC,KAAK,GAAAC,QAAA,CAALD,KAAK;IACb,IAAI,IAAI,CAACN,WAAW,EAAE;MACpB,IAAI,CAACA,WAAW,CAACQ,MAAM,EAAE;MACzB,IAAI,CAACR,WAAW,GAAG,IAAI;;IAEzB,IAAI,OAAO,IAAI,CAACF,SAAS,KAAK,UAAU,IAAI,CAACQ,KAAK,EAAE;MAClD,IAAI,CAACR,SAAS,CAACW,KAAK,CAAC,IAAI,EAAE,IAAI,CAACR,KAAK,CAAC;;GAEzC;EAAAC,MAAA,CAEDQ,UAAU,GAAV,SAAAA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AAA,OAAMoB,YAAY,CAACF,aAAa,CAAC;;KAAE;GACjE;EAAA,OAAA/B,WAAA;AAAA;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(){function t(t,a){this._callback=t,this._delayMS=a,this._taskHandle=null,this._args=null}var a=t.prototype;return a.dispose=function(t){void 0===t&&(t={abort:!1});var a=t.abort;this._taskHandle&&(this._taskHandle.cancel(),this._taskHandle=null),"function"!=typeof this._callback||a||this._callback.apply(this,this._args)},a.inSchedule=function(){return!!this._taskHandle},a.schedule=function(){for(var t=this,a=arguments.length,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(){function t(t,a){this._callback=t,this._delayMS=a,this._taskHandle=null,this._args=null}var a=t.prototype;return a.dispose=function(t){void 0===t&&(t={abort:!1});var a=t.abort;this._taskHandle&&(this._taskHandle.cancel(),this._taskHandle=null),"function"!=typeof this._callback||a||this._callback.apply(this,this._args)},a.inSchedule=function(){return!!this._taskHandle},a.flush=function(){for(var t=arguments.length,a=new Array(t),s=0;s<t;s++)a[s]=arguments[s];a.length&&(this._args=a),this._taskHandle&&(this._taskHandle.cancel(),this._taskHandle=null),this._callback.apply(this,this._args)},a.schedule=function(){for(var t=this,a=arguments.length,s=new Array(a),e=0;e<a;e++)s[e]=arguments[e];if(this._args=s,!this._taskHandle){var l=function(){Promise.resolve().then((function(){t._taskHandle=null,t._callback.apply(t,t._args)}))};if(this._delayMS){var n=setTimeout((function(){l()}),this._delayMS);this._taskHandle={cancel:function(){return clearTimeout(n)}}}else l()}},t}();
|
|
2
2
|
//# sourceMappingURL=batchinator.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batchinator.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["// import { InteractionManager } from 'react-native';\n\n// https://github.com/facebook/react-native/blob/main/Libraries/Interaction/Batchinator.js\n\nclass Batchinator {\n readonly _delayMS: number;\n private _args: Array<any>;\n\n private _callback: Function;\n private _taskHandle: {\n cancel: () => void;\n };\n\n constructor(cb: Function, delayMS: number) {\n this._callback = cb;\n this._delayMS = delayMS;\n this._taskHandle = null;\n this._args = null;\n }\n\n dispose(\n options: {\n abort: boolean;\n } = {\n abort: false,\n }\n ) {\n const { abort } = options;\n if (this._taskHandle) {\n this._taskHandle.cancel();\n this._taskHandle = null;\n }\n if (typeof this._callback === 'function' && !abort) {\n this._callback.apply(this, this._args);\n }\n }\n\n inSchedule() {\n return !!this._taskHandle;\n }\n\n schedule(...args) {\n this._args = args;\n\n if (this._taskHandle) return;\n const handler = () => {\n Promise.resolve().then(() => {\n this._taskHandle = null;\n this._callback.apply(this, this._args);\n });\n };\n\n if (!this._delayMS) {\n handler();\n return;\n }\n\n const timeoutHandle = setTimeout(() => {\n handler();\n }, this._delayMS);\n\n this._taskHandle = { cancel: () => clearTimeout(timeoutHandle) };\n }\n}\n\nexport default Batchinator;\n"],"names":["Batchinator","cb","delayMS","this","_callback","_delayMS","_taskHandle","_args","_proto","prototype","dispose","options","abort","cancel","apply","inSchedule","
|
|
1
|
+
{"version":3,"file":"batchinator.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["// import { InteractionManager } from 'react-native';\n\n// https://github.com/facebook/react-native/blob/main/Libraries/Interaction/Batchinator.js\n\nclass Batchinator {\n readonly _delayMS: number;\n private _args: Array<any>;\n\n private _callback: Function;\n private _taskHandle: {\n cancel: () => void;\n };\n\n constructor(cb: Function, delayMS: number) {\n this._callback = cb;\n this._delayMS = delayMS;\n this._taskHandle = null;\n this._args = null;\n }\n\n dispose(\n options: {\n abort: boolean;\n } = {\n abort: false,\n }\n ) {\n const { abort } = options;\n if (this._taskHandle) {\n this._taskHandle.cancel();\n this._taskHandle = null;\n }\n if (typeof this._callback === 'function' && !abort) {\n this._callback.apply(this, this._args);\n }\n }\n\n inSchedule() {\n return !!this._taskHandle;\n }\n\n flush(...args) {\n if (args.length) this._args = args;\n if (this._taskHandle) {\n this._taskHandle.cancel();\n this._taskHandle = null;\n }\n this._callback.apply(this, this._args);\n }\n\n schedule(...args) {\n this._args = args;\n\n if (this._taskHandle) return;\n const handler = () => {\n Promise.resolve().then(() => {\n this._taskHandle = null;\n this._callback.apply(this, this._args);\n });\n };\n\n if (!this._delayMS) {\n handler();\n return;\n }\n\n const timeoutHandle = setTimeout(() => {\n handler();\n }, this._delayMS);\n\n this._taskHandle = { cancel: () => clearTimeout(timeoutHandle) };\n }\n}\n\nexport default Batchinator;\n"],"names":["Batchinator","cb","delayMS","this","_callback","_delayMS","_taskHandle","_args","_proto","prototype","dispose","options","abort","cancel","apply","inSchedule","flush","args","Array","_len","_key","arguments","length","schedule","_len2","_key2","handler","Promise","resolve","then","_this","timeoutHandle","setTimeout","clearTimeout"],"mappings":"+FAaE,SAAAA,EAAYC,EAAcC,GACxBC,KAAKC,UAAYH,EACjBE,KAAKE,SAAWH,EAChBC,KAAKG,YAAc,KACnBH,KAAKI,MAAQ,KACd,IAAAC,EAAAR,EAAAS,UAqDA,OArDAD,EAEDE,QAAA,SACEC,YAAAA,IAAAA,EAEI,CACFC,OAAO,IAGT,IAAQA,EAAUD,EAAVC,MACJT,KAAKG,cACPH,KAAKG,YAAYO,SACjBV,KAAKG,YAAc,MAES,mBAAnBH,KAAKC,WAA6BQ,GAC3CT,KAAKC,UAAUU,MAAMX,KAAMA,KAAKI,QAEnCC,EAEDO,WAAA,WACE,QAASZ,KAAKG,aACfE,EAEDQ,MAAA,sCAASC,MAAIC,MAAAC,GAAAC,IAAAA,EAAAD,EAAAC,IAAJH,EAAIG,GAAAC,UAAAD,GACPH,EAAKK,SAAQnB,KAAKI,MAAQU,GAC1Bd,KAAKG,cACPH,KAAKG,YAAYO,SACjBV,KAAKG,YAAc,MAErBH,KAAKC,UAAUU,MAAMX,KAAMA,KAAKI,QACjCC,EAEDe,SAAA,6CAAYN,MAAIC,MAAAM,GAAAC,IAAAA,EAAAD,EAAAC,IAAJR,EAAIQ,GAAAJ,UAAAI,GAGd,GAFAtB,KAAKI,MAAQU,GAETd,KAAKG,YAAT,CACA,IAAMoB,EAAU,WACdC,QAAQC,UAAUC,MAAK,WACrBC,EAAKxB,YAAc,KACnBwB,EAAK1B,UAAUU,MAAMgB,EAAMA,EAAKvB,WAIpC,GAAKJ,KAAKE,SAAV,CAKA,IAAM0B,EAAgBC,YAAW,WAC/BN,MACCvB,KAAKE,UAERF,KAAKG,YAAc,CAAEO,OAAQ,WAAA,OAAMoB,aAAaF,UAR9CL,MASH1B"}
|
package/dist/batchinator.esm.js
CHANGED
|
@@ -25,11 +25,22 @@ var Batchinator = /*#__PURE__*/function () {
|
|
|
25
25
|
_proto.inSchedule = function inSchedule() {
|
|
26
26
|
return !!this._taskHandle;
|
|
27
27
|
};
|
|
28
|
-
_proto.
|
|
29
|
-
var _this = this;
|
|
28
|
+
_proto.flush = function flush() {
|
|
30
29
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
30
|
args[_key] = arguments[_key];
|
|
32
31
|
}
|
|
32
|
+
if (args.length) this._args = args;
|
|
33
|
+
if (this._taskHandle) {
|
|
34
|
+
this._taskHandle.cancel();
|
|
35
|
+
this._taskHandle = null;
|
|
36
|
+
}
|
|
37
|
+
this._callback.apply(this, this._args);
|
|
38
|
+
};
|
|
39
|
+
_proto.schedule = function schedule() {
|
|
40
|
+
var _this = this;
|
|
41
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
42
|
+
args[_key2] = arguments[_key2];
|
|
43
|
+
}
|
|
33
44
|
this._args = args;
|
|
34
45
|
if (this._taskHandle) return;
|
|
35
46
|
var handler = function handler() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batchinator.esm.js","sources":["../src/index.ts"],"sourcesContent":["// import { InteractionManager } from 'react-native';\n\n// https://github.com/facebook/react-native/blob/main/Libraries/Interaction/Batchinator.js\n\nclass Batchinator {\n readonly _delayMS: number;\n private _args: Array<any>;\n\n private _callback: Function;\n private _taskHandle: {\n cancel: () => void;\n };\n\n constructor(cb: Function, delayMS: number) {\n this._callback = cb;\n this._delayMS = delayMS;\n this._taskHandle = null;\n this._args = null;\n }\n\n dispose(\n options: {\n abort: boolean;\n } = {\n abort: false,\n }\n ) {\n const { abort } = options;\n if (this._taskHandle) {\n this._taskHandle.cancel();\n this._taskHandle = null;\n }\n if (typeof this._callback === 'function' && !abort) {\n this._callback.apply(this, this._args);\n }\n }\n\n inSchedule() {\n return !!this._taskHandle;\n }\n\n schedule(...args) {\n this._args = args;\n\n if (this._taskHandle) return;\n const handler = () => {\n Promise.resolve().then(() => {\n this._taskHandle = null;\n this._callback.apply(this, this._args);\n });\n };\n\n if (!this._delayMS) {\n handler();\n return;\n }\n\n const timeoutHandle = setTimeout(() => {\n handler();\n }, this._delayMS);\n\n this._taskHandle = { cancel: () => clearTimeout(timeoutHandle) };\n }\n}\n\nexport default Batchinator;\n"],"names":["Batchinator","cb","delayMS","_callback","_delayMS","_taskHandle","_args","_proto","prototype","dispose","options","abort","_options","cancel","apply","inSchedule","
|
|
1
|
+
{"version":3,"file":"batchinator.esm.js","sources":["../src/index.ts"],"sourcesContent":["// import { InteractionManager } from 'react-native';\n\n// https://github.com/facebook/react-native/blob/main/Libraries/Interaction/Batchinator.js\n\nclass Batchinator {\n readonly _delayMS: number;\n private _args: Array<any>;\n\n private _callback: Function;\n private _taskHandle: {\n cancel: () => void;\n };\n\n constructor(cb: Function, delayMS: number) {\n this._callback = cb;\n this._delayMS = delayMS;\n this._taskHandle = null;\n this._args = null;\n }\n\n dispose(\n options: {\n abort: boolean;\n } = {\n abort: false,\n }\n ) {\n const { abort } = options;\n if (this._taskHandle) {\n this._taskHandle.cancel();\n this._taskHandle = null;\n }\n if (typeof this._callback === 'function' && !abort) {\n this._callback.apply(this, this._args);\n }\n }\n\n inSchedule() {\n return !!this._taskHandle;\n }\n\n flush(...args) {\n if (args.length) this._args = args;\n if (this._taskHandle) {\n this._taskHandle.cancel();\n this._taskHandle = null;\n }\n this._callback.apply(this, this._args);\n }\n\n schedule(...args) {\n this._args = args;\n\n if (this._taskHandle) return;\n const handler = () => {\n Promise.resolve().then(() => {\n this._taskHandle = null;\n this._callback.apply(this, this._args);\n });\n };\n\n if (!this._delayMS) {\n handler();\n return;\n }\n\n const timeoutHandle = setTimeout(() => {\n handler();\n }, this._delayMS);\n\n this._taskHandle = { cancel: () => clearTimeout(timeoutHandle) };\n }\n}\n\nexport default Batchinator;\n"],"names":["Batchinator","cb","delayMS","_callback","_delayMS","_taskHandle","_args","_proto","prototype","dispose","options","abort","_options","cancel","apply","inSchedule","flush","args","Array","_len","_key","arguments","length","schedule","_len2","_key2","handler","Promise","resolve","then","_this","timeoutHandle","setTimeout","clearTimeout"],"mappings":"IAIMA,WAAW;EASf,SAAAA,YAAYC,EAAY,EAAEC,OAAe;IACvC,IAAI,CAACC,SAAS,GAAGF,EAAE;IACnB,IAAI,CAACG,QAAQ,GAAGF,OAAO;IACvB,IAAI,CAACG,WAAW,GAAG,IAAI;IACvB,IAAI,CAACC,KAAK,GAAG,IAAI;;EAClB,IAAAC,MAAA,GAAAP,WAAA,CAAAQ,SAAA;EAAAD,MAAA,CAEDE,OAAO,GAAP,SAAAA,QACEC;QAAAA;MAAAA,UAEI;QACFC,KAAK,EAAE;OACR;;IAED,IAAAC,QAAA,GAAkBF,OAAO;MAAjBC,KAAK,GAAAC,QAAA,CAALD,KAAK;IACb,IAAI,IAAI,CAACN,WAAW,EAAE;MACpB,IAAI,CAACA,WAAW,CAACQ,MAAM,EAAE;MACzB,IAAI,CAACR,WAAW,GAAG,IAAI;;IAEzB,IAAI,OAAO,IAAI,CAACF,SAAS,KAAK,UAAU,IAAI,CAACQ,KAAK,EAAE;MAClD,IAAI,CAACR,SAAS,CAACW,KAAK,CAAC,IAAI,EAAE,IAAI,CAACR,KAAK,CAAC;;GAEzC;EAAAC,MAAA,CAE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,MAAM,EAAE,SAAAA;QAAA,OAAMoB,YAAY,CAACF,aAAa,CAAC;;KAAE;GACjE;EAAA,OAAA/B,WAAA;AAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -39,6 +39,15 @@ class Batchinator {
|
|
|
39
39
|
return !!this._taskHandle;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
flush(...args) {
|
|
43
|
+
if (args.length) this._args = args;
|
|
44
|
+
if (this._taskHandle) {
|
|
45
|
+
this._taskHandle.cancel();
|
|
46
|
+
this._taskHandle = null;
|
|
47
|
+
}
|
|
48
|
+
this._callback.apply(this, this._args);
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
schedule(...args) {
|
|
43
52
|
this._args = args;
|
|
44
53
|
|