smartlog-destination-devtools/.cache/d9/8a75684a7f64c589162fef32d74aa0.json
2018-11-13 01:32:39 +01:00

1 line
5.5 KiB
JSON

{"id":"node_modules/@pushrocks/smartdelay/dist/index.js","dependencies":[{"name":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/@pushrocks/smartdelay/ts/index.ts","includedInParent":true,"mtime":499162500000},{"name":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/package.json","includedInParent":true,"mtime":1542067438335},{"name":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/@pushrocks/smartdelay/package.json","includedInParent":true,"mtime":1542058764035},{"name":"@pushrocks/smartpromise","loc":{"line":11,"column":29},"parent":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/@pushrocks/smartdelay/dist/index.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/@pushrocks/smartpromise/dist/index.js"}],"generated":{"js":"\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst smartpromise = require(\"@pushrocks/smartpromise\");\n/**\n * delay something, works like setTimeout\n * @param timeInMillisecond\n * @param passOn\n */\nexports.delayFor = (timeInMillisecond, passOn) => __awaiter(this, void 0, void 0, function* () {\n yield new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve();\n }, timeInMillisecond);\n });\n return passOn;\n});\n/**\n * delay for a random time\n */\nexports.delayForRandom = (timeMinInMillisecond, timeMaxInMillisecond, passOn) => __awaiter(this, void 0, void 0, function* () {\n yield new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve();\n }, Math.random() * (timeMaxInMillisecond - timeMinInMillisecond) + timeMinInMillisecond);\n });\n return passOn;\n});\nclass Timeout {\n constructor(timeInMillisecondArg, passOn) {\n this._cancelled = false;\n this._deferred = smartpromise.defer();\n this.promise = this._deferred.promise;\n this._timeout = setTimeout(() => {\n if (!this._cancelled) {\n this._deferred.resolve(passOn);\n }\n }, timeInMillisecondArg);\n }\n makeUnrefed() {\n this._timeout.unref();\n }\n cancel() {\n this._cancelled = true;\n this.makeUnrefed();\n }\n}\nexports.Timeout = Timeout;\n","map":{"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,wDAAwD;AAExD;;;;GAIG;AACQ,QAAA,QAAQ,GAAG,CAAU,iBAAyB,EAAE,MAAU,EAAE,EAAE;IACvE,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpC,UAAU,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,iBAAiB,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAA,CAAC;AAEF;;GAEG;AACQ,QAAA,cAAc,GAAG,CAC1B,oBAA4B,EAC5B,oBAA4B,EAC5B,MAAU,EACV,EAAE;IACF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpC,UAAU,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,oBAAoB,GAAG,oBAAoB,CAAC,GAAG,oBAAoB,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAA,CAAC;AAEF,MAAa,OAAO;IAKlB,YAAY,oBAAoB,EAAE,MAAU;QADpC,eAAU,GAAY,KAAK,CAAC;QAElC,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,KAAK,EAAK,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACpB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAChC;QACH,CAAC,EAAE,oBAAoB,CAAC,CAAC;IAC3B,CAAC;IAED,WAAW;QACT,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;CACF;AAvBD,0BAuBC","sourcesContent":["import * as smartpromise from '@pushrocks/smartpromise';\n\n/**\n * delay something, works like setTimeout\n * @param timeInMillisecond\n * @param passOn\n */\nexport let delayFor = async <T>(timeInMillisecond: number, passOn?: T) => {\n await new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve();\n }, timeInMillisecond);\n });\n return passOn;\n};\n\n/**\n * delay for a random time\n */\nexport let delayForRandom = async <T>(\n timeMinInMillisecond: number,\n timeMaxInMillisecond: number,\n passOn?: T\n) => {\n await new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve();\n }, Math.random() * (timeMaxInMillisecond - timeMinInMillisecond) + timeMinInMillisecond);\n });\n return passOn;\n};\n\nexport class Timeout<T> {\n promise: Promise<T>;\n private _deferred: smartpromise.Deferred<T>;\n private _timeout: any;\n private _cancelled: boolean = false;\n constructor(timeInMillisecondArg, passOn?: T) {\n this._deferred = smartpromise.defer<T>();\n this.promise = this._deferred.promise;\n this._timeout = setTimeout(() => {\n if (!this._cancelled) {\n this._deferred.resolve(passOn);\n }\n }, timeInMillisecondArg);\n }\n\n makeUnrefed() {\n this._timeout.unref();\n }\n\n cancel() {\n this._cancelled = true;\n this.makeUnrefed();\n }\n}\n"]}},"hash":"b22586b338a53a84c6a5c165d905f1a8","cacheData":{"env":{}}}