This is not my actual use case, but I am trying to understand the concept of how to load a view based on the information another view has using appgyver supersonic framework.
I have 3 pages, Login.html, MainPage.html, and Load.html. Each of them have their own controller. When the app opens it first goes to the login page. The login page sends the username and password to my server which then returns success or not. When there is success, the app goes to the main page. I would like for the load.html to understand a login has happened and start loading the view with the users appropriate content. This is so when the user goes from the main page to the load page all the information is already loaded. I am trying to understand the concept of how to accomplish this with supersonic.
You can use publish / subscribe methods between controllers.
Check out this doc for some good examples.
Basically, you want to publish a message with some data when the user is logged in. Your controller for after log in will be able to listen or subscribe to that message. When it receives the message it will be able to run any code you tell it in the callback.
One controller will publish:
Another controller will listen:
You can preload the views as well. This may help speed things up. If you don't, you may see a spinner in between view pushes. In
structure.coffee
in the config folder:When the login finishes, you can find the preloaded view and push it to the stack:
Hope this helps.