smart-nodes 0.3.34 → 0.3.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/delay/delay.js +4 -2
- package/forwarder/forwarder.js +1 -1
- package/package.json +1 -1
- package/smart_helper.js +10 -0
package/delay/delay.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const smart_helper = require("../smart_helper.js");
|
|
2
|
+
|
|
1
3
|
module.exports = function (RED)
|
|
2
4
|
{
|
|
3
5
|
"use strict";
|
|
@@ -140,7 +142,7 @@ module.exports = function (RED)
|
|
|
140
142
|
if (delay_ms <= 0)
|
|
141
143
|
{
|
|
142
144
|
node.status({ fill: "yellow", shape: "dot", text: helper.getCurrentTimeForStatus() + ": " + "Sended " + getMessageStatusText(msg) });
|
|
143
|
-
node_settings.last_message = msg
|
|
145
|
+
node_settings.last_message = helper.cloneObject(msg);
|
|
144
146
|
|
|
145
147
|
if (config.save_state)
|
|
146
148
|
smart_context.set(node.id, node_settings);
|
|
@@ -155,7 +157,7 @@ module.exports = function (RED)
|
|
|
155
157
|
{
|
|
156
158
|
timeout = null;
|
|
157
159
|
node.status({ fill: "yellow", shape: "dot", text: helper.getCurrentTimeForStatus() + ": " + "Sended " + getMessageStatusText(msg) });
|
|
158
|
-
node_settings.last_message = msg
|
|
160
|
+
node_settings.last_message = helper.cloneObject(msg);
|
|
159
161
|
|
|
160
162
|
if (config.save_state)
|
|
161
163
|
smart_context.set(node.id, node_settings);
|
package/forwarder/forwarder.js
CHANGED
package/package.json
CHANGED
package/smart_helper.js
CHANGED
|
@@ -295,5 +295,15 @@ module.exports = {
|
|
|
295
295
|
return date.getHours().toString().padStart(2, "0") + ":" +
|
|
296
296
|
date.getMinutes().toString().padStart(2, "0") + ":" +
|
|
297
297
|
date.getSeconds().toString().padStart(2, "0");
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Creates a new independend object and copies all properties to the new one
|
|
302
|
+
* @param {*} obj The Object to copy
|
|
303
|
+
* @returns A new Object
|
|
304
|
+
*/
|
|
305
|
+
cloneObject(obj)
|
|
306
|
+
{
|
|
307
|
+
return Object.assign({}, obj);
|
|
298
308
|
}
|
|
299
309
|
};
|