Beforeenter vs Async

Hi guys. This is just a simple question which i have not found the answer on google. Some people preferred beforeenter for authentication or similar. Then what about async?

  1. What is the async method ROLE on framework7?
  2. Is it the same as beforeenter?
  3. Which lifecycle stage is async? is it start from beforemounted or init?
  4. What if i want to use async for everything such as authenticate user, load axios, preloader, and navigate(resolve/reject) ?
    4.1) Is it going to impact my apps on performance?
    4.2) Is it safe for authentication part ?
    4.3) Assuming async is good, but when i am going to use it, my routes.js would be full
    with code since async is kinda tightly coupled with routes method. Is there any proper
    way to clean up a bit our code? (This is more like your personal opinion/way)

Reason of my question as such is because i am planning to work authentication, axios, preloader and navigate which must come in order for each page. Similarly i want to my apps to:

  1. check if the user is authenticate,
  2. If axios is needed don’t navigate to the page first but open preloader with custom text while getting the data,
  3. When requesting the data is complete, then can navigate to the particular page.

Which is why i come across with beforeenter & async topic since these two seems my solution to do all mentioned above.

EDITED: i have already found this link but seems not answering my question

If the docs already answered my question above, please include a link so that i can refer to it later.

Thanks a lot guys.

It is intended to return router content in async way.

No because it is intended to return content while beforeenter allows only to proceed or prevent loading

It is not a part of component/page lifecycle as it is executed before those

You can

1 Like