finnsson/pagerjs — pull request #169 by CuinnWylie (2014-03-06 02:33:33+00:00)
Title: Lazy load view model - VM should load before showing

I have modified pager to wait for the VM (if using withOnShow) before showing the page. The seems to better fit with the way that sourceOnShow works without requiring new events.

This allows for an initial VM setup when the VM is loaded and then a VM refresh during the shown events if caching. I have been using this for a while in my projects but forgot about it until the question came up in issue #166.

In my projects I have a function inside my VM that I query from the page model in the afterShown event that I use for refreshing data in my model. This way I don't have to globally track my model if I want to keep it all modular.

As always feel free to tell me I'm crazy and let me know how I should be doing this.