Skip to content

Commit b0e1157

Browse files
petermetzalsorokin
authored andcommitted
CB-11488 (browser) Guarding code against the case when deviceready fires earlier than the plugin init on cold-start
1 parent a18cc82 commit b0e1157

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/browser/SplashScreenProxy.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ var SplashScreen = {
7777

7878
localSplash.appendChild(localSplashImage);
7979
document.body.appendChild(localSplash);
80+
81+
// deviceready fires earlier than the plugin init on cold-start
82+
if (SplashScreen.shouldHideImmediately) {
83+
SplashScreen.shouldHideImmediately = false;
84+
window.setTimeout(function () {
85+
SplashScreen.hide();
86+
}, 1000);
87+
}
8088
}
8189
},
8290
hide: function () {
@@ -95,8 +103,8 @@ var SplashScreen = {
95103
document.body.removeChild(innerLocalSplash);
96104
innerLocalSplash = null;
97105
}, 1000);
98-
99-
106+
} else {
107+
SplashScreen.shouldHideImmediately = true;
100108
}
101109
}
102110
};

0 commit comments

Comments
 (0)