@ionic/vue alternative of Platform.ready() from '@ionic/angular'

In import { Platform } from '@ionic/angular'; we have
Platform.ready().then(() => { _call some native plugin here_ }); to make sure app is fully ready before calling any native service.


What is the alternative for @ionic/vue?


The closest thing we have in Vue is when we mount the app: starters/main.ts at fbf471ab8132b328cdf88c9273755bd15a9c6d57 · ionic-team/starters · GitHub

I assume we need to write our own utility to check for the deviceready event triggered when using Cordova plugins.

Are you running into a particular issue? Even if you used Cordova plugins in Capacitor you typically do not need to wait for the deviceready event.

Unfortunately cordova-sqlite-storage does not work if called before deviceready, throwing

 undefined is not an object (evaluating 'window.sqlitePlugin.openDatabase')

works fine when waiting for that event.

Ah darn. In that case yes you should add a deviceready event listener in your application.

1 Like