From b0e1157c8add1427179f29a77c0fc0d609ede29a Mon Sep 17 00:00:00 2001 From: "Peter (Somogyvari) Metz" Date: Fri, 1 Jul 2016 23:01:14 +0100 Subject: [PATCH] CB-11488 (browser) Guarding code against the case when deviceready fires earlier than the plugin init on cold-start --- src/browser/SplashScreenProxy.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/browser/SplashScreenProxy.js b/src/browser/SplashScreenProxy.js index 83c37d5..1a5cd30 100644 --- a/src/browser/SplashScreenProxy.js +++ b/src/browser/SplashScreenProxy.js @@ -77,6 +77,14 @@ var SplashScreen = { localSplash.appendChild(localSplashImage); document.body.appendChild(localSplash); + + // deviceready fires earlier than the plugin init on cold-start + if (SplashScreen.shouldHideImmediately) { + SplashScreen.shouldHideImmediately = false; + window.setTimeout(function () { + SplashScreen.hide(); + }, 1000); + } } }, hide: function () { @@ -95,8 +103,8 @@ var SplashScreen = { document.body.removeChild(innerLocalSplash); innerLocalSplash = null; }, 1000); - - + } else { + SplashScreen.shouldHideImmediately = true; } } };