Browser Events
There are several events that are triggered by the browser itself. In a way these are also user-interaction events; however, I want to keep them separate for this discussion. The browser events include things like the ready event when the document is loaded, as well as the resize event when the browser is resized.
These are useful to know when the view of the user is changing. You have already seen how to use the .on() function to add handlers for events; the question is where to put the handler. The best solutions I’ve seen involve a handler that is registered in the run block for the entire application. Any information can then be made available to subsequent components through the scope model or through a cache service.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access