This commit is contained in:
bkfox 2020-11-09 11:08:40 +01:00
parent 5eeb55bd6b
commit ba3cd8c2d4
3 changed files with 3 additions and 4 deletions

View File

@ -354,7 +354,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Live; });\n/* harmony import */ var public_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! public/utils */ \"./assets/public/utils.js\");\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./model */ \"./assets/public/model.js\");\n\n\n\nclass Live {\n constructor({url,timeout=10,src=\"\"}={}) {\n this.url = url;\n this.timeout = timeout;\n this.src = src;\n\n this.promise = null;\n this.items = [];\n }\n\n get current() {\n let items = this.logs && this.logs.items;\n let item = items && items[items.length-1];\n if(item)\n item.src = this.src;\n return item ? new _model__WEBPACK_IMPORTED_MODULE_1__[\"default\"](item) : null;\n }\n\n //-- data refreshing\n drop() {\n this.promise = null;\n }\n\n fetch() {\n const promise = fetch(this.url).then(response =>\n response.ok ? response.json()\n : Promise.reject(response)\n ).then(data => {\n this.items = data;\n return this.items\n })\n\n this.promise = promise;\n return promise;\n }\n\n refresh() {\n const promise = this.fetch();\n promise.then(data => {\n if(promise != this.promise)\n return [];\n\n Object(public_utils__WEBPACK_IMPORTED_MODULE_0__[\"setEcoTimeout\"])(() => this.refresh(), this.timeout*1000)\n })\n return promise\n }\n}\n\n\n\n//# sourceURL=webpack:///./assets/public/live.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Live; });\n/* harmony import */ var public_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! public/utils */ \"./assets/public/utils.js\");\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./model */ \"./assets/public/model.js\");\n\n\n\nclass Live {\n constructor({url,timeout=10,src=\"\"}={}) {\n this.url = url;\n this.timeout = timeout;\n this.src = src;\n\n this.promise = null;\n this.items = [];\n }\n\n get current() {\n let item = this.items && this.items[this.items.length-1];\n if(item)\n item.src = this.src;\n return item ? new _model__WEBPACK_IMPORTED_MODULE_1__[\"default\"](item) : null;\n }\n\n //-- data refreshing\n drop() {\n this.promise = null;\n }\n\n fetch() {\n const promise = fetch(this.url).then(response =>\n response.ok ? response.json()\n : Promise.reject(response)\n ).then(data => {\n this.items = data;\n return this.items\n })\n\n this.promise = promise;\n return promise;\n }\n\n refresh() {\n const promise = this.fetch();\n promise.then(data => {\n if(promise != this.promise)\n return [];\n\n Object(public_utils__WEBPACK_IMPORTED_MODULE_0__[\"setEcoTimeout\"])(() => this.refresh(), this.timeout*1000)\n })\n return promise\n }\n}\n\n\n\n//# sourceURL=webpack:///./assets/public/live.js?");
/***/ }),

View File

@ -295,7 +295,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Live; });\n/* harmony import */ var public_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! public/utils */ \"./assets/public/utils.js\");\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./model */ \"./assets/public/model.js\");\n\n\n\nclass Live {\n constructor({url,timeout=10,src=\"\"}={}) {\n this.url = url;\n this.timeout = timeout;\n this.src = src;\n\n this.promise = null;\n this.items = [];\n }\n\n get current() {\n let items = this.logs && this.logs.items;\n let item = items && items[items.length-1];\n if(item)\n item.src = this.src;\n return item ? new _model__WEBPACK_IMPORTED_MODULE_1__[\"default\"](item) : null;\n }\n\n //-- data refreshing\n drop() {\n this.promise = null;\n }\n\n fetch() {\n const promise = fetch(this.url).then(response =>\n response.ok ? response.json()\n : Promise.reject(response)\n ).then(data => {\n this.items = data;\n return this.items\n })\n\n this.promise = promise;\n return promise;\n }\n\n refresh() {\n const promise = this.fetch();\n promise.then(data => {\n if(promise != this.promise)\n return [];\n\n Object(public_utils__WEBPACK_IMPORTED_MODULE_0__[\"setEcoTimeout\"])(() => this.refresh(), this.timeout*1000)\n })\n return promise\n }\n}\n\n\n\n//# sourceURL=webpack:///./assets/public/live.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Live; });\n/* harmony import */ var public_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! public/utils */ \"./assets/public/utils.js\");\n/* harmony import */ var _model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./model */ \"./assets/public/model.js\");\n\n\n\nclass Live {\n constructor({url,timeout=10,src=\"\"}={}) {\n this.url = url;\n this.timeout = timeout;\n this.src = src;\n\n this.promise = null;\n this.items = [];\n }\n\n get current() {\n let item = this.items && this.items[this.items.length-1];\n if(item)\n item.src = this.src;\n return item ? new _model__WEBPACK_IMPORTED_MODULE_1__[\"default\"](item) : null;\n }\n\n //-- data refreshing\n drop() {\n this.promise = null;\n }\n\n fetch() {\n const promise = fetch(this.url).then(response =>\n response.ok ? response.json()\n : Promise.reject(response)\n ).then(data => {\n this.items = data;\n return this.items\n })\n\n this.promise = promise;\n return promise;\n }\n\n refresh() {\n const promise = this.fetch();\n promise.then(data => {\n if(promise != this.promise)\n return [];\n\n Object(public_utils__WEBPACK_IMPORTED_MODULE_0__[\"setEcoTimeout\"])(() => this.refresh(), this.timeout*1000)\n })\n return promise\n }\n}\n\n\n\n//# sourceURL=webpack:///./assets/public/live.js?");
/***/ }),

View File

@ -12,8 +12,7 @@ export default class Live {
}
get current() {
let items = this.logs && this.logs.items;
let item = items && items[items.length-1];
let item = this.items && this.items[this.items.length-1];
if(item)
item.src = this.src;
return item ? new Model(item) : null;