{"map":"{\"version\":3,\"file\":\"index.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/try-again/index.ts\"],\"names\":[],\"mappings\":\"AAAA,YAAY,CAAA;AAOZ;IAME,kBAAa,IAAc,EAAE,OAAgB;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAA;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;IACvB,CAAC;IAED,sBAAG,GAAH;QAAA,iBAKC;QAJC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC;YAAE,OAAO,KAAK,CAAA;QACjC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC;YAC1B,IAAI,KAAI,CAAC,KAAK,EAAE,GAAG,CAAC;gBAAE,KAAI,CAAC,IAAI,EAAE,IAAI,KAAI,CAAC,GAAG,EAAE,CAAA;QACjD,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAClB,CAAC;IAED,uBAAI,GAAJ;QACE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC9B,CAAC;IAED,uBAAI,GAAJ,UAAM,IAAY;QAChB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;IACrB,CAAC;IAED,uBAAI,GAAJ;QACE,IAAI,CAAC,IAAI,EAAE,CAAA;QACX,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;IAChB,CAAC;IACH,eAAC;AAAD,CAAC,AAhCD,IAgCC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA\",\"sourcesContent\":[\"'use strict'\\n\\ntype options = {\\n  polls: number\\n  timeout: number\\n}\\n\\nclass TryAgain {\\n  public polls: number\\n  private task: Function\\n  private timeout: number\\n  private timeoutId: any\\n\\n  constructor (task: Function, options: options) {\\n    this.task = task\\n    this.polls = options.polls || 2\\n    this.timeout = options.timeout || 3000\\n    this.timeoutId = null\\n  }\\n\\n  try () {\\n    if (this.polls <= 0) return false\\n    this.timeoutId = setTimeout(() => {\\n      if (this.polls-- > 0) this.task() && this.try()\\n    }, this.timeout)\\n  }\\n\\n  stop () {\\n    clearTimeout(this.timeoutId)\\n  }\\n\\n  wait (time: number) {\\n    this.timeout = time\\n  }\\n\\n  over () {\\n    this.stop()\\n    this.polls = 0\\n  }\\n}\\n\\nexport { TryAgain }\\n\"]}","code":"'use strict';\r\nvar TryAgain = /** @class */ (function () {\r\n    function TryAgain(task, options) {\r\n        this.task = task;\r\n        this.polls = options.polls || 2;\r\n        this.timeout = options.timeout || 3000;\r\n        this.timeoutId = null;\r\n    }\r\n    TryAgain.prototype.try = function () {\r\n        var _this = this;\r\n        if (this.polls <= 0)\r\n            return false;\r\n        this.timeoutId = setTimeout(function () {\r\n            if (_this.polls-- > 0)\r\n                _this.task() && _this.try();\r\n        }, this.timeout);\r\n    };\r\n    TryAgain.prototype.stop = function () {\r\n        clearTimeout(this.timeoutId);\r\n    };\r\n    TryAgain.prototype.wait = function (time) {\r\n        this.timeout = time;\r\n    };\r\n    TryAgain.prototype.over = function () {\r\n        this.stop();\r\n        this.polls = 0;\r\n    };\r\n    return TryAgain;\r\n}());\r\nexport { TryAgain };\r\n//# sourceMappingURL=index.js.map","dts":{"name":"/Users/ioing/libdev/shadow-function/dist/typings/try-again/index.d.ts","writeByteOrderMark":false,"text":"declare type options = {\r\n    polls: number;\r\n    timeout: number;\r\n};\r\ndeclare class TryAgain {\r\n    polls: number;\r\n    private task;\r\n    private timeout;\r\n    private timeoutId;\r\n    constructor(task: Function, options: options);\r\n    try(): false | undefined;\r\n    stop(): void;\r\n    wait(time: number): void;\r\n    over(): void;\r\n}\r\nexport { TryAgain };\r\n"}}
