Trying to build a simple node to show "mdToast" popups on incoming messages. Looking at the existing "Notification" node I see it uses ui.add
to insert itself, and not ui.addWidget
(like "normal" widgets which belong to a group
and have an order
do):
module.exports = function(RED) {
var ui = require('../ui')(RED);
function ToastNode(config) {
RED.nodes.createNode(this, config);
...
var done = ui.add({
node: node,
control: {},
storeFrontEndInputAsState: false,
forwardInputMessages: false,
beforeSend: function (msg) {
var m = msg.payload.msg;
m.topic = node.topic || m.topic;
return m;
}
});
Since what I'm trying to do very closely matches the "Notification" node I'm basically trying to to build a clone of this node - but the add
method is not available to me:
function MyNode(config) {
if(ui === undefined) {
ui = RED.require("node-red-dashboard")(RED);
}
...
var done = ui.add({
....
TypeError: ui.add is not a function
How do I add a hidden dashboard widget like ui_toast
does?