Added functions Device::pushCommand() and Device::popCommand()
This commit is contained in:
parent
052df06fb4
commit
c6e8caec73
1 changed files with 16 additions and 0 deletions
|
@ -1,4 +1,20 @@
|
||||||
function Device(id) {
|
function Device(id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = com.telldus.core.getName(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue