31 lines
1.4 KiB
JavaScript
31 lines
1.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Timer = void 0;
|
|
var Timer = /** @class */ (function () {
|
|
function Timer(Main) {
|
|
this.startup = document.querySelector('.ntsh-timer-startup');
|
|
this.shutdown = document.querySelector('.ntsh-timer-shutdown');
|
|
this._Main = Main;
|
|
this.registerListeners();
|
|
}
|
|
Timer.prototype.update = function (data) {
|
|
var start = "".concat(data.start.hour.toString().padStart(2, '0'), ":").concat(data.start.minute.toString().padStart(2, '0'));
|
|
var end = "".concat(data.end.hour.toString().padStart(2, '0'), ":").concat(data.end.minute.toString().padStart(2, '0'));
|
|
this.startup.value = start;
|
|
this.shutdown.value = end;
|
|
};
|
|
Timer.prototype.registerListeners = function () {
|
|
var _this = this;
|
|
this.startup.onchange = function () {
|
|
var _a = _this.startup.value.split(':').map(Number), hour = _a[0], minute = _a[1];
|
|
_this._Main.socket.emit('setTimerStart', { hour: hour, minute: minute });
|
|
};
|
|
this.shutdown.onchange = function () {
|
|
var _a = _this.shutdown.value.split(':').map(Number), hour = _a[0], minute = _a[1];
|
|
_this._Main.socket.emit('setTimerEnd', { hour: hour, minute: minute });
|
|
};
|
|
};
|
|
return Timer;
|
|
}());
|
|
exports.Timer = Timer;
|
|
//# sourceMappingURL=timer.js.map
|