masterblaster
Version:
Scheduling and componsation system for biodome
32 lines (25 loc) • 652 B
JavaScript
var time = require('./time-utils.js');
/**
* Not truly Abstract in the strict sense,
* but shit will blow up if you try to instantiate
*/
function AbstractDeviceEvent() {
this.opts = {};
this.opts.device = null;
this.opts.scheduledState = null;
this.opts.goTime = null;
this.timer = null; // later.setInterval or later.setTimeout
this.resolved = false;
}
var def = AbstractDeviceEvent.prototype;
def.on = function(when) {
this.opts.goTime = time.validateTimeText(when);
return this;
};
def.at = function(when) {
return this.on(when);
};
def.toJSON = function() {
return this.opts;
};
module.exports = AbstractDeviceEvent;