mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add flows:* events and deprecate nodes-* events
This commit is contained in:
@@ -28,6 +28,7 @@ var flowUtil = require("./util");
|
||||
var log;
|
||||
var events = require("../events");
|
||||
var redUtil = require("@node-red/util").util;
|
||||
const hooks = require("../hooks");
|
||||
|
||||
var storage = null;
|
||||
var settings = null;
|
||||
@@ -292,6 +293,8 @@ function start(type,diff,muteLog) {
|
||||
}
|
||||
}
|
||||
|
||||
events.emit("flows:starting", {config: activeConfig, type: type, diff: diff})
|
||||
|
||||
var id;
|
||||
if (type === "full") {
|
||||
// A full start means everything should
|
||||
@@ -352,6 +355,8 @@ function start(type,diff,muteLog) {
|
||||
}
|
||||
}
|
||||
}
|
||||
events.emit("flows:started", {config: activeConfig, type: type, diff: diff});
|
||||
// Deprecated event
|
||||
events.emit("nodes-started");
|
||||
|
||||
if (credentialsPendingReset === true) {
|
||||
@@ -399,6 +404,8 @@ function stop(type,diff,muteLog) {
|
||||
stopList = diff.changed.concat(diff.removed).concat(diff.linked);
|
||||
}
|
||||
|
||||
events.emit("flows:stopping",{config: activeConfig, type: type, diff: diff})
|
||||
|
||||
for (var id in activeFlows) {
|
||||
if (activeFlows.hasOwnProperty(id)) {
|
||||
var flowStateChanged = diff && (diff.added.indexOf(id) !== -1 || diff.removed.indexOf(id) !== -1);
|
||||
@@ -430,6 +437,8 @@ function stop(type,diff,muteLog) {
|
||||
log.info(log._("nodes.flows.stopped-flows"));
|
||||
}
|
||||
}
|
||||
events.emit("flows:stopped",{config: activeConfig, type: type, diff: diff});
|
||||
// Deprecated event
|
||||
events.emit("nodes-stopped");
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user