Is it possible that there is a setting somewhere for this behaviour?
Or maybe there is something I don't understand properly.
I put a simple count in a function node, obtaining a certain value after a few inject
var count=context.get("count")||0;
count=count+1;
context.set("count",count);
If later on I modify the code inside this node, after redeploy the context count (locale variable) maintain the previous value. It's not "resetted".
For what I have understood this is because the local context has been already created and it's already existing . So If I want to reset it, I have to manually delete it. Only in this way I have the same behaviour as for the inizial loading, when this local context doesn't exist. And this is what I need.
[{"id":"361541f.23712be","type":"function","z":"a716f67a.bcc3d8","name":"Prova","func":"msg1={}; msg2={};\nvar count=context.get(\"count\") || 0;\nvar Alm_Status = context.get(\"Alm_Status\")|| false;\ncount=count+1;\nif (count!==0) {\n switch (msg.payload) {\n case false:\n if (Alm_Status===true){\n //do domething\n msg1.payload = \"Reset allarme\"; \n }\n msg2.colour=\"#333333\";\n context.set(\"Alm_Status\",false);\n break;\n case true:\n if (Alm_Status===false){ \n //do domething\n msg1.payload= \"Alarm\"; \n msg2.colour=\"#FF0000\";\n context.set(\"Alm_Status\",true);\n } else {\n msg1=null;\n msg2=null; \n }\n }\n} else {\n msg1 = null;\n switch (msg.payload) {\n case false:\n msg2.colour=\"#333333\";\n Alm_Status = false;\n break;\n case true:\n msg2.colour=\"#FF0000\";\n Alm_Status = true;\n } \n}\ncontext.set(\"count\",count); \nreturn [msg1,msg2];\n","outputs":2,"noerr":0,"x":370,"y":300,"wires":[["adb90e0b.cbcd3"],["91f2127e.c24c4"]]},{"id":"adb90e0b.cbcd3","type":"debug","z":"a716f67a.bcc3d8","name":"DB1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":240,"wires":[]},{"id":"91f2127e.c24c4","type":"debug","z":"a716f67a.bcc3d8","name":"DB2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":320,"wires":[]},{"id":"1c9508de.3b3b27","type":"inject","z":"a716f67a.bcc3d8","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":260,"wires":[["361541f.23712be"]]},{"id":"be51da04.0fcfe8","type":"inject","z":"a716f67a.bcc3d8","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":320,"wires":[["361541f.23712be"]]}]