webdetector/.cache/f7/1474e0e33fec3b6f483b2d0e12f5ea.json
2018-12-21 13:36:28 +01:00

1 line
41 KiB
JSON

{"id":"../ts/index.ts","dependencies":[{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/package.json","includedInParent":true,"mtime":1545395695572},{"name":"./webdetector.plugins","loc":{"line":45,"column":35},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/ts/index.ts","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/ts/webdetector.plugins.ts"},{"name":"rxjs/operators","loc":{"line":46,"column":26},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/ts/index.ts","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/operators/index.js"}],"generated":{"js":"\"use strict\";\n\nvar __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : new P(function (resolve) {\n resolve(result.value);\n }).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n\nvar __importStar = this && this.__importStar || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result[\"default\"] = mod;\n return result;\n};\n\nexports.__esModule = true;\n\nvar plugins = __importStar(require(\"./webdetector.plugins\"));\n\nvar operators_1 = require(\"rxjs/operators\");\n\nvar WebDetector =\n/** @class */\nfunction () {\n function WebDetector(optionsArg) {\n this.onlineObservableIntake = new plugins.smartrx.ObservableIntake();\n this.onlineObservable = this.onlineObservableIntake.observable.pipe(operators_1.throttleTime(10000));\n this.latestState = 'online';\n this.options = optionsArg;\n }\n /**\n *\n */\n\n\n WebDetector.prototype.isOnline = function () {\n return __awaiter(this, void 0, void 0, function () {\n var reachesInternet, controller, fetchPromise, timeout, latestLocalState;\n\n var _this = this;\n\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n reachesInternet = false;\n controller = new AbortController();\n fetchPromise = fetch(this.options.checkOnlineUrl, {\n signal: controller.signal\n });\n timeout = setTimeout(function () {\n controller.abort();\n }, 1000);\n return [4\n /*yield*/\n , fetchPromise.then(function (response) {\n return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n reachesInternet = true;\n return [2\n /*return*/\n ];\n });\n });\n })[\"catch\"](function (err) {// console.log(`request to ${this.options.checkOnlineUrl} failed}`)\n })];\n\n case 1:\n _a.sent();\n\n latestLocalState = function () {\n if (reachesInternet) {\n return 'online';\n } else {\n return 'offline';\n }\n }();\n\n if (latestLocalState !== this.latestState) {\n this.onlineObservableIntake.push(this.latestState);\n }\n\n this.latestState = latestLocalState;\n return [2\n /*return*/\n , reachesInternet];\n }\n });\n });\n };\n\n WebDetector.prototype.startPeriodicChecks = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!true) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , this.isOnline()];\n\n case 1:\n _a.sent();\n\n return [4\n /*yield*/\n , plugins.smartdelay.delayFor(3000)];\n\n case 2:\n _a.sent();\n\n return [3\n /*break*/\n , 0];\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n return WebDetector;\n}();\n\nexports.WebDetector = WebDetector;","map":{"mappings":[{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":4}},{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":11}},{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":26}},{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":27}},{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":34}},{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":35}},{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":58}},{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":59}},{"source":"../ts/index.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":154,"column":60}},{"source":"../ts/index.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":156,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":156,"column":4}},{"source":"../ts/index.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":156,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":156,"column":18}},{"source":"../ts/index.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":156,"column":25}},{"source":"../ts/index.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":156,"column":26}},{"source":"../ts/index.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":156,"column":42}},{"source":"../ts/index.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":156,"column":43}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":0},"generated":{"line":158,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":0},"generated":{"line":158,"column":4}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":0},"generated":{"line":158,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":0},"generated":{"line":159,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":0},"generated":{"line":160,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":0},"generated":{"line":160,"column":12}},{"source":"../ts/index.ts","name":null,"original":{"line":15,"column":2},"generated":{"line":161,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":15,"column":2},"generated":{"line":161,"column":11}},{"source":"../ts/index.ts","name":null,"original":{"line":15,"column":2},"generated":{"line":161,"column":22}},{"source":"../ts/index.ts","name":null,"original":{"line":15,"column":14},"generated":{"line":161,"column":23}},{"source":"../ts/index.ts","name":null,"original":{"line":15,"column":2},"generated":{"line":161,"column":33}},{"source":"../ts/index.ts","name":null,"original":{"line":15,"column":45},"generated":{"line":161,"column":35}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":10},"generated":{"line":162,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":10},"generated":{"line":162,"column":9}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":10},"generated":{"line":162,"column":31}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":35},"generated":{"line":162,"column":34}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":39},"generated":{"line":162,"column":38}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":46},"generated":{"line":162,"column":45}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":47},"generated":{"line":162,"column":46}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":39},"generated":{"line":162,"column":53}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":55},"generated":{"line":162,"column":54}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":35},"generated":{"line":162,"column":70}},{"source":"../ts/index.ts","name":null,"original":{"line":11,"column":10},"generated":{"line":162,"column":72}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":2},"generated":{"line":163,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":2},"generated":{"line":163,"column":9}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":2},"generated":{"line":163,"column":25}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":21},"generated":{"line":163,"column":28}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":26},"generated":{"line":163,"column":33}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":21},"generated":{"line":163,"column":55}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":49},"generated":{"line":163,"column":56}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":21},"generated":{"line":163,"column":66}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":60},"generated":{"line":163,"column":67}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":21},"generated":{"line":163,"column":71}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":65},"generated":{"line":163,"column":72}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":65},"generated":{"line":163,"column":83}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":65},"generated":{"line":163,"column":84}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":65},"generated":{"line":163,"column":96}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":78},"generated":{"line":163,"column":97}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":65},"generated":{"line":163,"column":102}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":21},"generated":{"line":163,"column":103}},{"source":"../ts/index.ts","name":null,"original":{"line":12,"column":2},"generated":{"line":163,"column":104}},{"source":"../ts/index.ts","name":null,"original":{"line":13,"column":2},"generated":{"line":164,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":13,"column":2},"generated":{"line":164,"column":9}},{"source":"../ts/index.ts","name":null,"original":{"line":13,"column":2},"generated":{"line":164,"column":20}},{"source":"../ts/index.ts","name":null,"original":{"line":13,"column":38},"generated":{"line":164,"column":23}},{"source":"../ts/index.ts","name":null,"original":{"line":13,"column":2},"generated":{"line":164,"column":31}},{"source":"../ts/index.ts","name":null,"original":{"line":16,"column":4},"generated":{"line":165,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":16,"column":9},"generated":{"line":165,"column":9}},{"source":"../ts/index.ts","name":null,"original":{"line":16,"column":4},"generated":{"line":165,"column":16}},{"source":"../ts/index.ts","name":null,"original":{"line":16,"column":19},"generated":{"line":165,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":16,"column":4},"generated":{"line":165,"column":29}},{"source":"../ts/index.ts","name":null,"original":{"line":17,"column":3},"generated":{"line":166,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":19,"column":2},"generated":{"line":167,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":22,"column":8},"generated":{"line":172,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":22,"column":8},"generated":{"line":172,"column":2}},{"source":"../ts/index.ts","name":null,"original":{"line":22,"column":8},"generated":{"line":172,"column":13}},{"source":"../ts/index.ts","name":null,"original":{"line":22,"column":8},"generated":{"line":172,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":22,"column":8},"generated":{"line":172,"column":23}},{"source":"../ts/index.ts","name":null,"original":{"line":22,"column":8},"generated":{"line":172,"column":24}},{"source":"../ts/index.ts","name":null,"original":{"line":22,"column":8},"generated":{"line":172,"column":32}},{"source":"../ts/index.ts","name":null,"original":{"line":22,"column":2},"generated":{"line":172,"column":35}},{"source":"../ts/index.ts","name":null,"original":{"line":22,"column":2},"generated":{"line":172,"column":47}},{"source":"../ts/index.ts","name":null,"original":{"line":23,"column":8},"generated":{"line":181,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":23,"column":8},"generated":{"line":181,"column":12}},{"source":"../ts/index.ts","name":null,"original":{"line":23,"column":23},"generated":{"line":181,"column":27}},{"source":"../ts/index.ts","name":null,"original":{"line":23,"column":35},"generated":{"line":181,"column":30}},{"source":"../ts/index.ts","name":null,"original":{"line":23,"column":8},"generated":{"line":181,"column":35}},{"source":"../ts/index.ts","name":null,"original":{"line":24,"column":10},"generated":{"line":182,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":24,"column":10},"generated":{"line":182,"column":12}},{"source":"../ts/index.ts","name":null,"original":{"line":24,"column":20},"generated":{"line":182,"column":22}},{"source":"../ts/index.ts","name":null,"original":{"line":24,"column":23},"generated":{"line":182,"column":25}},{"source":"../ts/index.ts","name":null,"original":{"line":24,"column":27},"generated":{"line":182,"column":29}},{"source":"../ts/index.ts","name":null,"original":{"line":24,"column":23},"generated":{"line":182,"column":44}},{"source":"../ts/index.ts","name":null,"original":{"line":24,"column":10},"generated":{"line":182,"column":46}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":10},"generated":{"line":183,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":10},"generated":{"line":183,"column":12}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":22},"generated":{"line":183,"column":24}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":25},"generated":{"line":183,"column":27}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":30},"generated":{"line":183,"column":32}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":31},"generated":{"line":183,"column":33}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":36},"generated":{"line":183,"column":38}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":31},"generated":{"line":183,"column":45}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":44},"generated":{"line":183,"column":46}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":30},"generated":{"line":183,"column":60}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":60},"generated":{"line":183,"column":62}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":62},"generated":{"line":184,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":62},"generated":{"line":184,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":68},"generated":{"line":184,"column":20}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":70},"generated":{"line":184,"column":22}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":80},"generated":{"line":184,"column":32}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":81},"generated":{"line":184,"column":33}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":60},"generated":{"line":185,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":30},"generated":{"line":185,"column":13}},{"source":"../ts/index.ts","name":null,"original":{"line":25,"column":10},"generated":{"line":185,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":26,"column":10},"generated":{"line":186,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":26,"column":10},"generated":{"line":186,"column":12}},{"source":"../ts/index.ts","name":null,"original":{"line":26,"column":17},"generated":{"line":186,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":26,"column":20},"generated":{"line":186,"column":22}},{"source":"../ts/index.ts","name":null,"original":{"line":26,"column":30},"generated":{"line":186,"column":32}},{"source":"../ts/index.ts","name":null,"original":{"line":26,"column":31},"generated":{"line":186,"column":33}},{"source":"../ts/index.ts","name":null,"original":{"line":26,"column":31},"generated":{"line":186,"column":45}},{"source":"../ts/index.ts","name":null,"original":{"line":27,"column":6},"generated":{"line":187,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":27,"column":6},"generated":{"line":187,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":27,"column":16},"generated":{"line":187,"column":24}},{"source":"../ts/index.ts","name":null,"original":{"line":27,"column":17},"generated":{"line":187,"column":25}},{"source":"../ts/index.ts","name":null,"original":{"line":27,"column":6},"generated":{"line":187,"column":30}},{"source":"../ts/index.ts","name":null,"original":{"line":28,"column":5},"generated":{"line":188,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":26,"column":30},"generated":{"line":188,"column":13}},{"source":"../ts/index.ts","name":null,"original":{"line":28,"column":7},"generated":{"line":188,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":26,"column":30},"generated":{"line":188,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":26,"column":10},"generated":{"line":188,"column":20}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":189,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":189,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":189,"column":20}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":190,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":191,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":10},"generated":{"line":191,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":22},"generated":{"line":191,"column":26}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":23},"generated":{"line":191,"column":27}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":10},"generated":{"line":191,"column":31}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":28},"generated":{"line":191,"column":32}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":34},"generated":{"line":191,"column":42}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":28},"generated":{"line":191,"column":50}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":191,"column":52}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":21}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":30}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":31}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":36}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":38}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":43}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":44}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":46}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":51}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":52}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":54}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":192,"column":66}},{"source":"../ts/index.ts","name":null,"original":{"line":31,"column":8},"generated":{"line":194,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":31,"column":8},"generated":{"line":194,"column":18}},{"source":"../ts/index.ts","name":null,"original":{"line":31,"column":23},"generated":{"line":194,"column":33}},{"source":"../ts/index.ts","name":null,"original":{"line":31,"column":26},"generated":{"line":194,"column":36}},{"source":"../ts/index.ts","name":null,"original":{"line":31,"column":8},"generated":{"line":194,"column":40}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":199,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":42},"generated":{"line":199,"column":16}},{"source":"../ts/index.ts","name":null,"original":{"line":32,"column":5},"generated":{"line":200,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":10},"generated":{"line":200,"column":13}},{"source":"../ts/index.ts","name":null,"original":{"line":32,"column":7},"generated":{"line":200,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":10},"generated":{"line":200,"column":22}},{"source":"../ts/index.ts","name":null,"original":{"line":32,"column":13},"generated":{"line":200,"column":24}},{"source":"../ts/index.ts","name":null,"original":{"line":32,"column":13},"generated":{"line":200,"column":34}},{"source":"../ts/index.ts","name":null,"original":{"line":32,"column":13},"generated":{"line":200,"column":37}},{"source":"../ts/index.ts","name":null,"original":{"line":32,"column":16},"generated":{"line":200,"column":39}},{"source":"../ts/index.ts","name":null,"original":{"line":33,"column":6},"generated":{"line":200,"column":40}},{"source":"../ts/index.ts","name":null,"original":{"line":34,"column":5},"generated":{"line":201,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":10},"generated":{"line":201,"column":13}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":201,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":201,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":204,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":204,"column":12}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":204,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":204,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":30,"column":4},"generated":{"line":204,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":35,"column":10},"generated":{"line":206,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":35,"column":10},"generated":{"line":206,"column":12}},{"source":"../ts/index.ts","name":null,"original":{"line":35,"column":26},"generated":{"line":206,"column":28}},{"source":"../ts/index.ts","name":null,"original":{"line":35,"column":30},"generated":{"line":206,"column":31}},{"source":"../ts/index.ts","name":null,"original":{"line":35,"column":30},"generated":{"line":206,"column":43}},{"source":"../ts/index.ts","name":null,"original":{"line":36,"column":6},"generated":{"line":207,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":36,"column":9},"generated":{"line":207,"column":18}},{"source":"../ts/index.ts","name":null,"original":{"line":36,"column":6},"generated":{"line":207,"column":33}},{"source":"../ts/index.ts","name":null,"original":{"line":36,"column":26},"generated":{"line":207,"column":35}},{"source":"../ts/index.ts","name":null,"original":{"line":37,"column":8},"generated":{"line":208,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":37,"column":15},"generated":{"line":208,"column":23}},{"source":"../ts/index.ts","name":null,"original":{"line":37,"column":8},"generated":{"line":208,"column":31}},{"source":"../ts/index.ts","name":null,"original":{"line":38,"column":7},"generated":{"line":209,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":36,"column":6},"generated":{"line":209,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":38,"column":13},"generated":{"line":209,"column":21}},{"source":"../ts/index.ts","name":null,"original":{"line":39,"column":8},"generated":{"line":210,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":39,"column":15},"generated":{"line":210,"column":23}},{"source":"../ts/index.ts","name":null,"original":{"line":39,"column":8},"generated":{"line":210,"column":32}},{"source":"../ts/index.ts","name":null,"original":{"line":40,"column":7},"generated":{"line":211,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":41,"column":5},"generated":{"line":212,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":35,"column":29},"generated":{"line":212,"column":13}},{"source":"../ts/index.ts","name":null,"original":{"line":35,"column":10},"generated":{"line":212,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":42,"column":4},"generated":{"line":214,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":42,"column":7},"generated":{"line":214,"column":16}},{"source":"../ts/index.ts","name":null,"original":{"line":42,"column":23},"generated":{"line":214,"column":32}},{"source":"../ts/index.ts","name":null,"original":{"line":42,"column":28},"generated":{"line":214,"column":37}},{"source":"../ts/index.ts","name":null,"original":{"line":42,"column":33},"generated":{"line":214,"column":42}},{"source":"../ts/index.ts","name":null,"original":{"line":42,"column":4},"generated":{"line":214,"column":53}},{"source":"../ts/index.ts","name":null,"original":{"line":42,"column":46},"generated":{"line":214,"column":55}},{"source":"../ts/index.ts","name":null,"original":{"line":44,"column":6},"generated":{"line":215,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":44,"column":11},"generated":{"line":215,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":44,"column":6},"generated":{"line":215,"column":41}},{"source":"../ts/index.ts","name":null,"original":{"line":44,"column":34},"generated":{"line":215,"column":42}},{"source":"../ts/index.ts","name":null,"original":{"line":44,"column":6},"generated":{"line":215,"column":46}},{"source":"../ts/index.ts","name":null,"original":{"line":44,"column":39},"generated":{"line":215,"column":47}},{"source":"../ts/index.ts","name":null,"original":{"line":44,"column":44},"generated":{"line":215,"column":52}},{"source":"../ts/index.ts","name":null,"original":{"line":44,"column":6},"generated":{"line":215,"column":63}},{"source":"../ts/index.ts","name":null,"original":{"line":45,"column":5},"generated":{"line":216,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":46,"column":4},"generated":{"line":218,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":46,"column":9},"generated":{"line":218,"column":17}},{"source":"../ts/index.ts","name":null,"original":{"line":46,"column":4},"generated":{"line":218,"column":28}},{"source":"../ts/index.ts","name":null,"original":{"line":46,"column":23},"generated":{"line":218,"column":31}},{"source":"../ts/index.ts","name":null,"original":{"line":46,"column":4},"generated":{"line":218,"column":47}},{"source":"../ts/index.ts","name":null,"original":{"line":47,"column":4},"generated":{"line":219,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":47,"column":4},"generated":{"line":219,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":47,"column":4},"generated":{"line":219,"column":20}},{"source":"../ts/index.ts","name":null,"original":{"line":47,"column":4},"generated":{"line":220,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":47,"column":4},"generated":{"line":221,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":47,"column":11},"generated":{"line":221,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":47,"column":4},"generated":{"line":221,"column":29}},{"source":"../ts/index.ts","name":null,"original":{"line":47,"column":4},"generated":{"line":221,"column":30}},{"source":"../ts/index.ts","name":null,"original":{"line":48,"column":3},"generated":{"line":225,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":22,"column":8},"generated":{"line":225,"column":3}},{"source":"../ts/index.ts","name":null,"original":{"line":50,"column":8},"generated":{"line":227,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":50,"column":8},"generated":{"line":227,"column":2}},{"source":"../ts/index.ts","name":null,"original":{"line":50,"column":8},"generated":{"line":227,"column":13}},{"source":"../ts/index.ts","name":null,"original":{"line":50,"column":8},"generated":{"line":227,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":50,"column":8},"generated":{"line":227,"column":23}},{"source":"../ts/index.ts","name":null,"original":{"line":50,"column":8},"generated":{"line":227,"column":24}},{"source":"../ts/index.ts","name":null,"original":{"line":50,"column":8},"generated":{"line":227,"column":43}},{"source":"../ts/index.ts","name":null,"original":{"line":50,"column":2},"generated":{"line":227,"column":46}},{"source":"../ts/index.ts","name":null,"original":{"line":50,"column":2},"generated":{"line":227,"column":58}},{"source":"../ts/index.ts","name":null,"original":{"line":51,"column":11},"generated":{"line":232,"column":17}},{"source":"../ts/index.ts","name":null,"original":{"line":51,"column":15},"generated":{"line":232,"column":23}},{"source":"../ts/index.ts","name":null,"original":{"line":51,"column":15},"generated":{"line":232,"column":30}},{"source":"../ts/index.ts","name":null,"original":{"line":51,"column":15},"generated":{"line":232,"column":31}},{"source":"../ts/index.ts","name":null,"original":{"line":51,"column":15},"generated":{"line":233,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":51,"column":15},"generated":{"line":234,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":51,"column":15},"generated":{"line":234,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":51,"column":15},"generated":{"line":234,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":51,"column":15},"generated":{"line":234,"column":16}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":235,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":235,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":235,"column":20}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":236,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":237,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":12},"generated":{"line":237,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":17},"generated":{"line":237,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":12},"generated":{"line":237,"column":27}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":237,"column":29}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":237,"column":30}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":240,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":240,"column":12}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":240,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":240,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":52,"column":6},"generated":{"line":240,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":242,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":242,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":242,"column":20}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":243,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":244,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":12},"generated":{"line":244,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":19},"generated":{"line":244,"column":21}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":20},"generated":{"line":244,"column":22}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":12},"generated":{"line":244,"column":32}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":31},"generated":{"line":244,"column":33}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":12},"generated":{"line":244,"column":41}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":40},"generated":{"line":244,"column":42}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":12},"generated":{"line":244,"column":46}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":244,"column":47}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":244,"column":48}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":247,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":247,"column":12}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":247,"column":14}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":247,"column":15}},{"source":"../ts/index.ts","name":null,"original":{"line":53,"column":6},"generated":{"line":247,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":55,"column":3},"generated":{"line":260,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":50,"column":8},"generated":{"line":260,"column":3}},{"source":"../ts/index.ts","name":null,"original":{"line":56,"column":0},"generated":{"line":262,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":56,"column":0},"generated":{"line":262,"column":9}},{"source":"../ts/index.ts","name":null,"original":{"line":56,"column":0},"generated":{"line":262,"column":20}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":0},"generated":{"line":263,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":0},"generated":{"line":263,"column":1}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":0},"generated":{"line":263,"column":3}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":13},"generated":{"line":265,"column":0}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":13},"generated":{"line":265,"column":7}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":13},"generated":{"line":265,"column":8}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":13},"generated":{"line":265,"column":19}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":13},"generated":{"line":265,"column":22}},{"source":"../ts/index.ts","name":null,"original":{"line":9,"column":13},"generated":{"line":265,"column":33}}],"sources":{"../ts/index.ts":"import * as plugins from './webdetector.plugins';\n\nimport {throttleTime } from 'rxjs/operators';\n\nexport interface IWebDetectorOptions {\n checkOnlineUrl: string;\n}\n\nexport class WebDetector {\n options: IWebDetectorOptions;\n private onlineObservableIntake = new plugins.smartrx.ObservableIntake();\n onlineObservable = this.onlineObservableIntake.observable.pipe(throttleTime(10000));\n latestState: 'online' | 'offline' = 'online';\n\n constructor(optionsArg: IWebDetectorOptions) {\n this.options = optionsArg;\n }\n\n /**\n * \n */\n async isOnline() {\n let reachesInternet: boolean = false;\n const controller = new AbortController();\n const fetchPromise = fetch(this.options.checkOnlineUrl, { signal: controller.signal });\n const timeout = setTimeout(() => {\n controller.abort();\n }, 1000);\n\n await fetchPromise.then(async response => {\n reachesInternet = true\n }).catch(err => {\n // console.log(`request to ${this.options.checkOnlineUrl} failed}`)\n });\n const latestLocalState = (() => {\n if(reachesInternet) {\n return 'online'\n } else {\n return 'offline'\n }\n })();\n if(latestLocalState !== this.latestState) {\n \n this.onlineObservableIntake.push(this.latestState);\n }\n this.latestState = latestLocalState;\n return reachesInternet;\n }\n\n async startPeriodicChecks() {\n while (true) {\n await this.isOnline();\n await plugins.smartdelay.delayFor(3000);\n }\n }\n}"},"lineCount":null}},"hash":"4913b0168e79dc2f8bd73b8d05c5c7ee","cacheData":{"env":{}}}