hmmmm, so where to start?
I know - I'll start with - I really don't mean to step on anyone's toes or upset anyone - I only wish to help
I understand @bakman2 request for "event": "clicked"
but to force this into payload? Surely payload is what the user wants to send?
I know we could force the output to "payload": { "elementId": "myCircle", "event": "clicked" }
but what would be the point of using a typedInput
? The typedInput provides the kind of flexibility that makes node-red super convenient.
I find permitting the user to specify his own payload
(be that a timestamp, bool, JSON etc) greatly reduces the need for extra change
nodes afterwards.
Could we please compromise?
Someone once told me when they wish to include extra information in a msg
(but not necessarily want it in the payload), to avoid collisions and to provide consistency, they add an object to the msg like msg.nodename.props
& include whatever they need to. I took that on board & find it very useful.
e.g. imagine this msg
structure...
{
ui_sgv: {
event: "click",
elementId: "myCircle",
coordinates: { x: 27, y: 33 }
}
topic : "camera/1/ptz"
payload : { pan: 90, tilt: 120, zoom: 3 }
}
-
msg.ui_sgv
is auto generated & includes whatever extra useful info we wish (and is extensible) -
msg.topic
andmsg.payload
are whatever the user desired (as entered in the form).
I much prefer this means of topic/payload and it is in line with many of the better nodes including (to name a few) inject, trigger, dashboard ui_button...
I have already added (on my local copy of your code) the typed input & it works great. So to round this off & hopefully I have sold it to you, this is a demo of it...