Allow Smooth node to be reset by msg.reset

to close #273
This commit is contained in:
Dave Conway-Jones
2017-02-07 21:41:18 +00:00
parent 7e421db642
commit 93c85ca7cd
5 changed files with 35 additions and 2 deletions

View File

@@ -16,6 +16,13 @@ module.exports = function(RED) {
var old = null;
this.on('input', function (msg) {
if (msg.hasOwnProperty("reset")) {
a = [];
tot = 0;
tot2 = 0;
pop = 0;
old = null;
}
if (msg.hasOwnProperty("payload")) {
var n = Number(msg.payload);
if (!isNaN(n)) {