What is the best place to do App.Init stuff?

Hey All,

I’m struggling a little with the App Lifecycle.

I have an authentication provider that I want to define when the app init fires; so far so good.

My problem happens when my pages load and beforeEnter I do a checkAuth function, which fails on the first page because the authentication provider has not finished loaded.

Is there anyway to do required loading before the app finishes and starts loading pages?

Many thanks,

Scott

It can be done with JS promises for example. You can just use .then() in your beforeEnter checks to do the check when your provider initialised.

Otherwise you can call new Framework7 (to init app) also after your provider initialized

That is fantastic! thanks!

That seems to have completely solved my problem.

setup_provider().then( success -> try login, failure -> bail);

Cheers!