- From: Ben Lesh <notifications@github.com>
- Date: Mon, 29 Jan 2018 19:42:36 +0000 (UTC)
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 29 January 2018 19:47:15 UTC
@bzbarsky > There is some sort of queuing happening in an Observable that is not being observed, right? Is this limited in any way? If I do on("mousemove") and then never subscribe to it, have I just created an unbounded memory leak? No, there is no queuing at all. If you don't subscribe to the observable returned by `on('mousemove')` it will effectively be the same thing as not adding an event listener in the first place. Observables do nothing until they are subscribed to. > When do the observables created by on get created? For example, if I on("DOMContentLoaded") after that event has fired, will I get that notification? The observable itself is created at the moment `on("DOMContentLoaded")` is called. However observation does not start until you subscribe to the observable. > Does on create a new observable each time? Yes... however since whatever you're observing already exists, every one of them will effectively multicast. Technically, we *could* have each call to `on` return the same observable, as there wouldn't be any difference in behavior. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/544#issuecomment-361362572
Received on Monday, 29 January 2018 19:47:15 UTC