Javascript – Dispatch event to all objects in a set

How do I dispatch a custom event to all the custom objects in my set?

class Node{...}

a = new Node(...);
b = new Node(...);

var nodeSet = new Set(...);
let myEvent = new CustomEvent(...);

for (var node of nodeSet){
     node.shape.dispatchEvent(myEvent); 
}

Node.shape is a Konva Shape

Please keep the replies easy to understand since I am a beginner in Javascript, thanks.

14 thoughts on “Javascript – Dispatch event to all objects in a set”

Leave a Comment