Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why use platform.ready() ? #5

Closed
nicobytes opened this issue Feb 2, 2020 · 2 comments
Closed

Why use platform.ready() ? #5

nicobytes opened this issue Feb 2, 2020 · 2 comments

Comments

@nicobytes
Copy link

Hello!

I have a question about init app, in the article about capacitor 1.0 saw:

Screen Shot 2020-02-02 at 7 01 00 PM

But in your code use:

initializeApp() {
    this.platform.ready().then(() => {
      this.statusBar.styleDefault();
      
      SplashScreen.hide();
    });
  }

What is the reason? I understand if I use Cordova I must use platform.ready but with Capacitor, it's not necessary.

@dotNetkow
Copy link
Contributor

Great question! See here. I'll add this link to the repo itself as a comment, too.

To make sure you provide the fastest app loading experience to your users, you must hide the splash screen automatically when your app is ready to be used. Simply add the SplashScreen.hide() call near the top of your app's JS, such as in app.component.ts if using Angular.

@dotNetkow
Copy link
Contributor

Apologies - I didn't explain this very well. This was a mistake, we actually don't need the Platform ready() call there, as you mentioned. Calling SplashScreen.hide() is still ok, though. I've updated the code in the "v5-migration" branch, shipping soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants