{"ast":null,"code":"'use strict';\n\nimport InteractionManager from \"../../../exports/InteractionManager\";\n\nvar Batchinator = function () {\n  function Batchinator(callback, delayMS) {\n    this._delay = delayMS;\n    this._callback = callback;\n  }\n\n  var _proto = Batchinator.prototype;\n\n  _proto.dispose = function 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  _proto.schedule = function schedule() {\n    var _this = this;\n\n    if (this._taskHandle) {\n      return;\n    }\n\n    var timeoutHandle = setTimeout(function () {\n      _this._taskHandle = InteractionManager.runAfterInteractions(function () {\n        _this._taskHandle = null;\n\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}();\n\nexport default Batchinator;","map":{"version":3,"sources":["/Users/rohitsingh/Documents/projects/new-nativebase-setup/NativeBase/example/node_modules/react-native-web/dist/vendor/react-native/Batchinator/index.js"],"names":["InteractionManager","Batchinator","callback","delayMS","_delay","_callback","_proto","prototype","dispose","options","abort","_taskHandle","cancel","schedule","_this","timeoutHandle","setTimeout","runAfterInteractions","clearTimeout"],"mappings":"AASA;;AAEA,OAAOA,kBAAP;;AAwBA,IAAIC,WAAW,GAAgB,YAAY;AACzC,WAASA,WAAT,CAAqBC,QAArB,EAA+BC,OAA/B,EAAwC;AACtC,SAAKC,MAAL,GAAcD,OAAd;AACA,SAAKE,SAAL,GAAiBH,QAAjB;AACD;;AASD,MAAII,MAAM,GAAGL,WAAW,CAACM,SAAzB;;AAEAD,EAAAA,MAAM,CAACE,OAAP,GAAiB,SAASA,OAAT,CAAiBC,OAAjB,EAA0B;AACzC,QAAIA,OAAO,KAAK,KAAK,CAArB,EAAwB;AACtBA,MAAAA,OAAO,GAAG;AACRC,QAAAA,KAAK,EAAE;AADC,OAAV;AAGD;;AAED,QAAI,KAAKC,WAAT,EAAsB;AACpB,WAAKA,WAAL,CAAiBC,MAAjB;;AAEA,UAAI,CAACH,OAAO,CAACC,KAAb,EAAoB;AAClB,aAAKL,SAAL;AACD;;AAED,WAAKM,WAAL,GAAmB,IAAnB;AACD;AACF,GAhBD;;AAkBAL,EAAAA,MAAM,CAACO,QAAP,GAAkB,SAASA,QAAT,GAAoB;AACpC,QAAIC,KAAK,GAAG,IAAZ;;AAEA,QAAI,KAAKH,WAAT,EAAsB;AACpB;AACD;;AAED,QAAII,aAAa,GAAGC,UAAU,CAAC,YAAY;AACzCF,MAAAA,KAAK,CAACH,WAAN,GAAoBX,kBAAkB,CAACiB,oBAAnB,CAAwC,YAAY;AAGtEH,QAAAA,KAAK,CAACH,WAAN,GAAoB,IAApB;;AAEAG,QAAAA,KAAK,CAACT,SAAN;AACD,OANmB,CAApB;AAOD,KAR6B,EAQ3B,KAAKD,MARsB,CAA9B;AASA,SAAKO,WAAL,GAAmB;AACjBC,MAAAA,MAAM,EAAE,SAASA,MAAT,GAAkB;AACxB,eAAOM,YAAY,CAACH,aAAD,CAAnB;AACD;AAHgB,KAAnB;AAKD,GArBD;;AAuBA,SAAOd,WAAP;AACD,CAzD8B,EAA/B;;AA2DA,eAAeA,WAAf","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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\nvar Batchinator = /*#__PURE__*/function () {\n  function Batchinator(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  var _proto = Batchinator.prototype;\n\n  _proto.dispose = function 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  _proto.schedule = function schedule() {\n    var _this = this;\n\n    if (this._taskHandle) {\n      return;\n    }\n\n    var timeoutHandle = setTimeout(function () {\n      _this._taskHandle = InteractionManager.runAfterInteractions(function () {\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: function cancel() {\n        return clearTimeout(timeoutHandle);\n      }\n    };\n  };\n\n  return Batchinator;\n}();\n\nexport default Batchinator;"]},"metadata":{},"sourceType":"module"}