1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

moved to use the on("close", function(){}) rather than overload the close

function
This commit is contained in:
Ben Hardill 2013-10-13 17:40:20 +01:00
parent 74d8958526
commit 74c57faa6c

View File

@ -65,6 +65,13 @@ function DelayNode(n) {
}, node.timeout);
this.idList.push(id);
});
this.on("close", function() {
for (var i=0; i<this.idList.length; i++ ) {
clearTimeout(this.idList[i]);
}
this.idList = [];
});
} else if (this.pauseType == "rate") {
this.on("input", function(msg) {
@ -87,6 +94,11 @@ function DelayNode(n) {
},node.rate);
}
});
this.on("close", function() {
clearInterval(this.intervalID);
this.buffer = [];
});
}
}
@ -95,15 +107,3 @@ function DelayNode(n) {
// register node
RED.nodes.registerType("delay",DelayNode);
DelayNode.prototype.close = function() {
if (this.pauseType == "delay") {
for (var i=0; i<this.idList.length; i++ ) {
clearTimeout(this.idList[i]);
}
this.idList = [];
} else if (this.pauseType == "rate") {
clearInterval(this.intervalID);
this.buffer = [];
}
}