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:
parent
74d8958526
commit
74c57faa6c
@ -65,6 +65,13 @@ function DelayNode(n) {
|
|||||||
}, node.timeout);
|
}, node.timeout);
|
||||||
this.idList.push(id);
|
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") {
|
} else if (this.pauseType == "rate") {
|
||||||
|
|
||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
@ -87,6 +94,11 @@ function DelayNode(n) {
|
|||||||
},node.rate);
|
},node.rate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.on("close", function() {
|
||||||
|
clearInterval(this.intervalID);
|
||||||
|
this.buffer = [];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,15 +107,3 @@ function DelayNode(n) {
|
|||||||
// register node
|
// register node
|
||||||
RED.nodes.registerType("delay",DelayNode);
|
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 = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user