Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3FF7B200B29 for ; Thu, 30 Jun 2016 17:17:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3E91C160A52; Thu, 30 Jun 2016 15:17:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 854BD160A06 for ; Thu, 30 Jun 2016 17:17:09 +0200 (CEST) Received: (qmail 92794 invoked by uid 500); 30 Jun 2016 15:17:08 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 92783 invoked by uid 99); 30 Jun 2016 15:17:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jun 2016 15:17:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3486BDFF03; Thu, 30 Jun 2016 15:17:08 +0000 (UTC) From: daserge To: dev@cordova.apache.org Reply-To: dev@cordova.apache.org References: In-Reply-To: Subject: [GitHub] cordova-plugin-splashscreen issue #107: Browser platform brought closer to i... Content-Type: text/plain Message-Id: <20160630151708.3486BDFF03@git1-us-west.apache.org> Date: Thu, 30 Jun 2016 15:17:08 +0000 (UTC) archived-at: Thu, 30 Jun 2016 15:17:10 -0000 Github user daserge commented on the issue: https://github.com/apache/cordova-plugin-splashscreen/pull/107 @petermetz, thanks for your contribution! The code looks good to me, although there is an issue that the splashscreen does not hide on server cold-start sometimes: ```javascript // index.js onDeviceReady: function() { app.receivedEvent('deviceready'); navigator.splashscreen.hide(); }, ``` It could be caused by the async nature of `initAndShow` which needs to retrieve and apply config.xml so that `hide` is called before `show`. Proper solution could be to make the Browser platform wait for the splashscreen plugin init. A workaround could be like this: ```javascript show: function () { if(!localSplash) { window.addEventListener("resize", onResize, false); localSplash = document.createElement("div"); localSplash.style.backgroundColor = bgColor; localSplash.style.position = "absolute"; localSplash.style["z-index"] = "99999"; localSplashImage = document.createElement("img"); localSplashImage.src = imageSrc; localSplashImage.style.position = "absolute"; updateImageLocation(); localSplash.appendChild(localSplashImage); document.body.appendChild(localSplash); // deviceready fires earlier than the plugin init on cold-start if (shouldHideImmediately) { shouldHideImmediately = false; window.setTimeout(function () { SplashScreen.hide(); }, 1000); } } }, hide: function () { if(localSplash) { var innerLocalSplash = localSplash; localSplash = null; window.removeEventListener("resize", onResize, false); innerLocalSplash.style.opacity = '0'; innerLocalSplash.style["-webkit-transition"] = "opacity 1s ease-in-out"; innerLocalSplash.style["-moz-transition"] = "opacity 1s ease-in-out"; innerLocalSplash.style["-ms-transition"] = "opacity 1s ease-in-out"; innerLocalSplash.style["-o-transition"] = "opacity 1s ease-in-out"; window.setTimeout(function () { document.body.removeChild(innerLocalSplash); innerLocalSplash = null; }, 1000); } else { shouldHideImmediately = true; } } ``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org For additional commands, e-mail: dev-help@cordova.apache.org