Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/nvl-receive.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module.exports = function(RED) {
let listId = msg.id || node.listId;
let pack = msg.pack || node.pack;
let nvl = {};
const resetCounter = msg.resetCounter;

if(typeof msg.nvl === 'string' || msg.nvl instanceof String){
//Use dynamic nvl
try{
Expand Down Expand Up @@ -120,6 +122,10 @@ module.exports = function(RED) {
};
}

if(resetCounter) {
node.mem[listId].cntFull = -1;
}

//Create new counter storage space if needed
if (!(tele.counter in node.mem[listId])){
node.mem[listId][tele.counter] = {
Expand Down
6 changes: 6 additions & 0 deletions src/nvl-send.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module.exports = function(RED) {
let listId = msg.id || node.listId;
let pack = msg.pack || node.pack;
let nvl = {};
const resetCounter = msg.resetCounter;

if(typeof msg.nvl === 'string' || msg.nvl instanceof String){
//Use dynamic nvl
try{
Expand Down Expand Up @@ -66,6 +68,10 @@ module.exports = function(RED) {
node.mem[listId] = {counter: 0, data: nvl.getDefault()};
}

if(resetCounter) {
node.mem[listId].counter = typeof resetCounter === 'number' ? resetCounter : 0;
}

try{
//Build data
merge( node.mem[listId].data , msg.payload );
Expand Down