mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
6d2793cac6
commit
82ae2e7118
@ -32,8 +32,14 @@ function wrapEventFunction(obj,func) {
|
||||
return function(eventName, listener) {
|
||||
if (deprecatedEvents.hasOwnProperty(eventName)) {
|
||||
const log = require("@node-red/util").log;
|
||||
const stack = (new Error().stack).split("\n")[2].split("(")[1].slice(0,-1);
|
||||
log.warn(`[RED.events] Deprecated use of "${eventName}" event from "${stack}". Use "${deprecatedEvents[eventName]}" instead.`)
|
||||
|
||||
const stack = (new Error().stack).split("\n");
|
||||
let location = "(unknown)"
|
||||
// See https://github.com/node-red/node-red/issues/3292
|
||||
if (stack.length > 2) {
|
||||
location = stack[2].split("(")[1].slice(0,-1);
|
||||
}
|
||||
log.warn(`[RED.events] Deprecated use of "${eventName}" event from "${location}". Use "${deprecatedEvents[eventName]}" instead.`)
|
||||
}
|
||||
return events["_"+func].call(events,eventName,listener)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user