Skip to content

Commit ae73592

Browse files
committed
If on Cordova wait until device is ready before bootstrapping app
1 parent 93c1db3 commit ae73592

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/app/main.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ export async function configure(aurelia: Aurelia): Promise<void> {
9494
.feature('resources/converters')
9595
;
9696

97+
/**
98+
* If we are on Cordova we have to wait until the device is ready.
99+
* Removing this could cause breaking Cordova Plugins
100+
*/
101+
await new Promise(resolve => appConfigService.platformIsMobile()
102+
? document.addEventListener('deviceready', () => resolve(), false)
103+
: resolve());
104+
97105
await aurelia.start();
98106
aurelia.setRoot('app.vm');
99107

0 commit comments

Comments
 (0)