You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
4.9 KiB
1 line
4.9 KiB
{"ast":null,"code":"'use strict';\n\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport InteractionManager from \"../../../exports/InteractionManager\";\nvar Batchinator = function () {\n function Batchinator(callback, delayMS) {\n _classCallCheck(this, Batchinator);\n this._delay = delayMS;\n this._callback = callback;\n }\n _createClass(Batchinator, [{\n key: \"dispose\",\n value: function dispose(options) {\n if (options === void 0) {\n options = {\n abort: false\n };\n }\n if (this._taskHandle) {\n this._taskHandle.cancel();\n if (!options.abort) {\n this._callback();\n }\n this._taskHandle = null;\n }\n }\n }, {\n key: \"schedule\",\n value: function schedule() {\n var _this = this;\n if (this._taskHandle) {\n return;\n }\n var timeoutHandle = setTimeout(function () {\n _this._taskHandle = InteractionManager.runAfterInteractions(function () {\n _this._taskHandle = null;\n _this._callback();\n });\n }, this._delay);\n this._taskHandle = {\n cancel: function cancel() {\n return clearTimeout(timeoutHandle);\n }\n };\n }\n }]);\n return Batchinator;\n}();\nexport default Batchinator;","map":{"version":3,"names":["InteractionManager","Batchinator","callback","delayMS","_delay","_callback","options","abort","_taskHandle","cancel","timeoutHandle","setTimeout","runAfterInteractions","clearTimeout"],"sources":["/Users/thomaschazot/Documents/But2A/LaSuperMeteo/iut-expo-starter/node_modules/react-native-web/dist/vendor/react-native/Batchinator/index.js"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n */\n'use strict';\n\nimport InteractionManager from '../../../exports/InteractionManager';\n/**\n * A simple class for batching up invocations of a low-pri callback. A timeout is set to run the\n * callback once after a delay, no matter how many times it's scheduled. Once the delay is reached,\n * InteractionManager.runAfterInteractions is used to invoke the callback after any hi-pri\n * interactions are done running.\n *\n * Make sure to cleanup with dispose(). Example:\n *\n * class Widget extends React.Component {\n * _batchedSave: new Batchinator(() => this._saveState, 1000);\n * _saveSate() {\n * // save this.state to disk\n * }\n * componentDidUpdate() {\n * this._batchedSave.schedule();\n * }\n * componentWillUnmount() {\n * this._batchedSave.dispose();\n * }\n * ...\n * }\n */\n\nclass Batchinator {\n constructor(callback, delayMS) {\n this._delay = delayMS;\n this._callback = callback;\n }\n /*\n * Cleanup any pending tasks.\n *\n * By default, if there is a pending task the callback is run immediately. Set the option abort to\n * true to not call the callback if it was pending.\n */\n\n\n dispose(options) {\n if (options === void 0) {\n options = {\n abort: false\n };\n }\n\n if (this._taskHandle) {\n this._taskHandle.cancel();\n\n if (!options.abort) {\n this._callback();\n }\n\n this._taskHandle = null;\n }\n }\n\n schedule() {\n if (this._taskHandle) {\n return;\n }\n\n var timeoutHandle = setTimeout(() => {\n this._taskHandle = InteractionManager.runAfterInteractions(() => {\n // Note that we clear the handle before invoking the callback so that if the callback calls\n // schedule again, it will actually schedule another task.\n this._taskHandle = null;\n\n this._callback();\n });\n }, this._delay);\n this._taskHandle = {\n cancel: () => clearTimeout(timeoutHandle)\n };\n }\n\n}\n\nexport default Batchinator;"],"mappings":"AASA,YAAY;;AAAC;AAAA;AAEb,OAAOA,kBAAkB;AAA4C,IAwB/DC,WAAW;EACf,qBAAYC,QAAQ,EAAEC,OAAO,EAAE;IAAA;IAC7B,IAAI,CAACC,MAAM,GAAGD,OAAO;IACrB,IAAI,CAACE,SAAS,GAAGH,QAAQ;EAC3B;EAAC;IAAA;IAAA,OASD,iBAAQI,OAAO,EAAE;MACf,IAAIA,OAAO,KAAK,KAAK,CAAC,EAAE;QACtBA,OAAO,GAAG;UACRC,KAAK,EAAE;QACT,CAAC;MACH;MAEA,IAAI,IAAI,CAACC,WAAW,EAAE;QACpB,IAAI,CAACA,WAAW,CAACC,MAAM,EAAE;QAEzB,IAAI,CAACH,OAAO,CAACC,KAAK,EAAE;UAClB,IAAI,CAACF,SAAS,EAAE;QAClB;QAEA,IAAI,CAACG,WAAW,GAAG,IAAI;MACzB;IACF;EAAC;IAAA;IAAA,OAED,oBAAW;MAAA;MACT,IAAI,IAAI,CAACA,WAAW,EAAE;QACpB;MACF;MAEA,IAAIE,aAAa,GAAGC,UAAU,CAAC,YAAM;QACnC,KAAI,CAACH,WAAW,GAAGR,kBAAkB,CAACY,oBAAoB,CAAC,YAAM;UAG/D,KAAI,CAACJ,WAAW,GAAG,IAAI;UAEvB,KAAI,CAACH,SAAS,EAAE;QAClB,CAAC,CAAC;MACJ,CAAC,EAAE,IAAI,CAACD,MAAM,CAAC;MACf,IAAI,CAACI,WAAW,GAAG;QACjBC,MAAM,EAAE;UAAA,OAAMI,YAAY,CAACH,aAAa,CAAC;QAAA;MAC3C,CAAC;IACH;EAAC;EAAA;AAAA;AAIH,eAAeT,WAAW"},"metadata":{},"sourceType":"module"} |