Closed george-lim closed 1 year ago
Is this actually used for DOM nodes? It looks like it's used for Workers, WebSocket, WebRTC, etc.
dominator doesn't handle any of those things, it's only for DOM nodes.
For things like WebSocket, there are other crates like gloo-net. For Workers there is gloo-worker, and for general event listening there is gloo-events:
let listener = EventListener::new(&window().unwrap(), "message", move |event| {
...
});
You're right, I was basically only going to use it with .global_event
. Seems like a bad idea to include that into Dominator when these events are focused more on DOM nodes. I'll just use gloo-events
👍
Adds the message event so that we can add event listeners to respond to messages sent from different origins, like service worker or web worker.
Docs: https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent