1 line
6.6 KiB
JSON
1 line
6.6 KiB
JSON
|
{"id":"../node_modules/@pushrocks/smarttime/dist/smarttime.classes.timer.js","dependencies":[{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/@pushrocks/smarttime/ts/smarttime.classes.timer.ts","includedInParent":true,"mtime":499162500000},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/package.json","includedInParent":true,"mtime":1545395695572},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/@pushrocks/smarttime/package.json","includedInParent":true,"mtime":1545395356342},{"name":"./smarttime.plugins","loc":{"line":3,"column":24},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/@pushrocks/smarttime/dist/smarttime.classes.timer.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/@pushrocks/smarttime/dist/smarttime.plugins.js"},{"name":"./smarttime.classes.timestamp","loc":{"line":4,"column":46},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/@pushrocks/smarttime/dist/smarttime.classes.timer.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/@pushrocks/smarttime/dist/smarttime.classes.timestamp.js"}],"generated":{"js":"\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst plugins = require(\"./smarttime.plugins\");\nconst smarttime_classes_timestamp_1 = require(\"./smarttime.classes.timestamp\");\nclass Timer {\n constructor(timeInMillisecondsArg) {\n /**\n * the state of the timer\n */\n this.state = 'initiated';\n // a deferred triggeted when Timer has completed\n this.completedDeferred = plugins.smartpromise.defer();\n this.timeInMilliseconds = timeInMillisecondsArg;\n this.completed = this.completedDeferred.promise;\n }\n get timeLeft() {\n return this.timeInMilliseconds - this.pausedAt.change;\n }\n /**\n * starts the timer\n */\n start() {\n if (!this.startedAt) {\n this.currentTimeout = setTimeout(() => {\n this.completedDeferred.resolve();\n }, this.timeInMilliseconds);\n this.startedAt = new smarttime_classes_timestamp_1.TimeStamp();\n }\n else {\n throw new Error('timer has been started before. Please use resume instead');\n }\n }\n pause() {\n if (this.startedAt) {\n clearTimeout(this.currentTimeout);\n this.currentTimeout = null;\n this.pausedAt = smarttime_classes_timestamp_1.TimeStamp.fromTimeStamp(this.startedAt);\n }\n }\n resume() {\n if (this.startedAt) {\n this.currentTimeout = setTimeout(() => {\n this.completedDeferred.resolve();\n }, this.timeLeft);\n }\n else {\n throw new Error('timer has NOT been started before. Please use .start() instead');\n }\n }\n reset() {\n this.pause();\n this.startedAt = null;\n this.pausedAt = null;\n }\n}\nexports.Timer = Timer;\n","map":{"version":3,"file":"smarttime.classes.timer.js","sourceRoot":"","sources":["../ts/smarttime.classes.timer.ts"],"names":[],"mappings":";;AAAA,+CAA+C;AAE/C,+EAA0D;AAI1D,MAAa,KAAK;IAqChB,YAAY,qBAA6B;QA/BzC;;WAEG;QACI,UAAK,GAAe,WAAW,CAAC;QAyBvC,gDAAgD;QACxC,sBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,EAAQ,CAAC;QAG7D,IAAI,CAAC,kBAAkB,GAAG,qBAAqB,CAAC;QAChD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;IAClD,CAAC;IAdD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IACxD,CAAC;IAcD;;OAEG;IACI,KAAK;QACV,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,GAAG,EAAE;gBACpC,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;YACnC,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,uCAAS,EAAE,CAAC;SAClC;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;SAC7E;IACH,CAAC;IAEM,KAAK;QACV,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAClC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAC3B,IAAI,CAAC,QAAQ,GAAG,uCAAS,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACzD;IACH,CAAC;IAEM,MAAM;Q
|