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.
To make your custom event work with Konva
Nodeobjects, theShapesubclass has anonmethod that will allow you to register your listener directly on the shape.Do this: