UNPKG

repoweaver

Version:

A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies

1 lines 4.55 kB
{"ast":null,"code":"'use strict';\n\nimport InteractionManager from \"../../../exports/InteractionManager\";\nclass Batchinator {\n constructor(callback, delayMS) {\n this._delay = delayMS;\n this._callback = callback;\n }\n 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 schedule() {\n if (this._taskHandle) {\n return;\n }\n var timeoutHandle = setTimeout(() => {\n this._taskHandle = InteractionManager.runAfterInteractions(() => {\n this._taskHandle = null;\n this._callback();\n });\n }, this._delay);\n this._taskHandle = {\n cancel: () => clearTimeout(timeoutHandle)\n };\n }\n}\nexport default Batchinator;","map":{"version":3,"names":["InteractionManager","Batchinator","constructor","callback","delayMS","_delay","_callback","dispose","options","abort","_taskHandle","cancel","schedule","timeoutHandle","setTimeout","runAfterInteractions","clearTimeout"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/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\n'use strict';\n\nimport InteractionManager from '../../../exports/InteractionManager';\n\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 */\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 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 schedule() {\n if (this._taskHandle) {\n return;\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 this._callback();\n });\n }, this._delay);\n this._taskHandle = {\n cancel: () => clearTimeout(timeoutHandle)\n };\n }\n}\nexport default Batchinator;"],"mappings":"AAUA,YAAY;;AAEZ,OAAOA,kBAAkB;AAwBzB,MAAMC,WAAW,CAAC;EAChBC,WAAWA,CAACC,QAAQ,EAAEC,OAAO,EAAE;IAC7B,IAAI,CAACC,MAAM,GAAGD,OAAO;IACrB,IAAI,CAACE,SAAS,GAAGH,QAAQ;EAC3B;EAOAI,OAAOA,CAACC,OAAO,EAAE;IACf,IAAIA,OAAO,KAAK,KAAK,CAAC,EAAE;MACtBA,OAAO,GAAG;QACRC,KAAK,EAAE;MACT,CAAC;IACH;IACA,IAAI,IAAI,CAACC,WAAW,EAAE;MACpB,IAAI,CAACA,WAAW,CAACC,MAAM,CAAC,CAAC;MACzB,IAAI,CAACH,OAAO,CAACC,KAAK,EAAE;QAClB,IAAI,CAACH,SAAS,CAAC,CAAC;MAClB;MACA,IAAI,CAACI,WAAW,GAAG,IAAI;IACzB;EACF;EACAE,QAAQA,CAAA,EAAG;IACT,IAAI,IAAI,CAACF,WAAW,EAAE;MACpB;IACF;IACA,IAAIG,aAAa,GAAGC,UAAU,CAAC,MAAM;MACnC,IAAI,CAACJ,WAAW,GAAGV,kBAAkB,CAACe,oBAAoB,CAAC,MAAM;QAG/D,IAAI,CAACL,WAAW,GAAG,IAAI;QACvB,IAAI,CAACJ,SAAS,CAAC,CAAC;MAClB,CAAC,CAAC;IACJ,CAAC,EAAE,IAAI,CAACD,MAAM,CAAC;IACf,IAAI,CAACK,WAAW,GAAG;MACjBC,MAAM,EAAEA,CAAA,KAAMK,YAAY,CAACH,aAAa;IAC1C,CAAC;EACH;AACF;AACA,eAAeZ,WAAW","ignoreList":[]},"metadata":{"hasCjsExports":false},"sourceType":"module","externalDependencies":[]}