Added functions Device::pushCommand() and Device::popCommand()

This commit is contained in:
Micke Prag 2011-01-12 12:09:12 +00:00
parent 052df06fb4
commit c6e8caec73

View file

@ -1,4 +1,20 @@
function Device(id) {
this.id = id;
this.name = com.telldus.core.getName(id);
this.commandStack = new Array();
}
Device.prototype.pushCommand = function(command) {
this.commandStack.push(command);
command.execute(this.id);
}
Device.prototype.popCommand = function(command) {
this.commandStack.pop();
if (this.commandStack.length) {
var command = this.commandStack[this.commandStack.length-1].execute(this.id);
} else {
com.telldus.core.turnOff(this.id);
}
}