You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by al...@apache.org on 2017/07/11 08:57:32 UTC

[5/6] cordova-plugin-splashscreen git commit: CB-11488 (browser) Guarding code against the case when deviceready fires earlier than the plugin init on cold-start

CB-11488 (browser) Guarding code against the case when deviceready fires earlier than the plugin init on cold-start


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/b0e1157c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/b0e1157c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/b0e1157c

Branch: refs/heads/master
Commit: b0e1157c8add1427179f29a77c0fc0d609ede29a
Parents: a18cc82
Author: Peter (Somogyvari) Metz <pe...@unarin.com>
Authored: Fri Jul 1 23:01:14 2016 +0100
Committer: Alexander Sorokin <al...@akvelon.com>
Committed: Tue Jul 11 10:55:19 2017 +0300

----------------------------------------------------------------------
 src/browser/SplashScreenProxy.js | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/b0e1157c/src/browser/SplashScreenProxy.js
----------------------------------------------------------------------
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;
         }
     }
 };


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org