Are there any best practices or suggested ways of reading/writing the window object? For example ‘writing to window.localstorage’? Further, are there any best practices to handle window events? Such as ‘onresize’, ‘onunload’? Can they be accessed in any component or service?
Most of what you need is avaible through either build in methods in Ember or through often throughly tested ember addons (remember to look for the version stamp and how often the addon has been updated).
Concerning eventing you can easily handle events. On the URL below at the bottom of the page, there is a list of available events:
Concerning the localstorage, you might want to concider using a LocalStorage adapter. Remember that you can easily have different adapters per route, if needed be, but still keep relations. Last time I used it was when I made a shopping basket. The products was handled via a RestAdapter, and the basket part with a LocalStorage… and there was a lot of belongsTo and hasMany relations between the two.
Yes, I’ve seen that section at ember guide. I’m not sure to handle some window events on components. For example to handle window storage events or battery events, I’d prefer services.
By the way, we are not using ember-data. Wrapping localstorage with ember-data is not suitable for me.