Events from custom nodes #886
-
I have some problems to understand the complete concept concerning the handling of the events from custom nodes. It is clear how to send an event from the node. But looking at the documentation and examples, I couldn't understand how to catch them. If I have several instances of one of my custom nodes, how can I find out which one sends the event? I think that probably I can't find a way to send also the node ID, but I couldn't find such example. Can I get a short example? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Mh? Which event are you talking about specifically? In the end it's really just something like this onNodeClick(({ node, event, connectedEdges }) => {
console.log(node)
if (node.id === id) {
// do something
}
}) |
Beta Was this translation helpful? Give feedback.
-
Hi again! I still cannot understand something. As I wrote above, now I can send and receive the event. But I always get two events - one with content {"isTrusted":true,"_vts":1683375379380} and after it follows my event. I read about this 'isTrusted' property, but it should be a property of my event. In my case it is in another separated event. So I suspect that I'm doing something not completely correct. But what it could be? |
Beta Was this translation helpful? Give feedback.
-
The code is already given above. I have a checkbox in my custom node. It seems that this first event is send when the checkbox state is changed. The second event is sent by my emit. But I couldn't find information how can I disable this event, generated by the checkbox. |
Beta Was this translation helpful? Give feedback.
It's the intended way, yeah