Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D043B1018C for ; Thu, 18 Apr 2013 15:30:09 +0000 (UTC) Received: (qmail 25334 invoked by uid 500); 18 Apr 2013 15:30:09 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 25176 invoked by uid 500); 18 Apr 2013 15:30:06 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 24780 invoked by uid 99); 18 Apr 2013 15:30:02 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Apr 2013 15:30:02 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 2C2C7479A2; Thu, 18 Apr 2013 15:30:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ian@apache.org To: commits@cordova.apache.org Message-Id: <0a57e8f5e2be4c519cb5f487b7956c96@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: js commit: Allow platform.initialize and cordovaReady to fire before DOMContentLoaded Date: Thu, 18 Apr 2013 15:30:02 +0000 (UTC) Updated Branches: refs/heads/master 3fe2dbc75 -> 2ba3bae46 Allow platform.initialize and cordovaReady to fire before DOMContentLoaded Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/2ba3bae4 Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/2ba3bae4 Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/2ba3bae4 Branch: refs/heads/master Commit: 2ba3bae4696784437f73002511a8ec40dd0dff34 Parents: 3fe2dbc Author: Ian Clelland Authored: Thu Apr 18 10:24:44 2013 -0400 Committer: Ian Clelland Committed: Thu Apr 18 11:06:39 2013 -0400 ---------------------------------------------------------------------- lib/common/channel.js | 1 + lib/scripts/bootstrap.js | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2ba3bae4/lib/common/channel.js ---------------------------------------------------------------------- diff --git a/lib/common/channel.js b/lib/common/channel.js index d22e57d..23d1d66 100644 --- a/lib/common/channel.js +++ b/lib/common/channel.js @@ -260,5 +260,6 @@ channel.createSticky('onDestroy'); // Channels that must fire before "deviceready" is fired. channel.waitForInitialization('onCordovaReady'); channel.waitForInitialization('onCordovaConnectionReady'); +channel.waitForInitialization('onDOMContentLoaded'); module.exports = channel; http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2ba3bae4/lib/scripts/bootstrap.js ---------------------------------------------------------------------- diff --git a/lib/scripts/bootstrap.js b/lib/scripts/bootstrap.js index 98c4bfa..31979fa 100644 --- a/lib/scripts/bootstrap.js +++ b/lib/scripts/bootstrap.js @@ -21,7 +21,7 @@ (function (context) { var channel = require('cordova/channel'); - var platfromInitChannels = [channel.onDOMContentLoaded, channel.onNativeReady, channel.onPluginsReady]; + var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady]; function logUnfiredChannels(arr) { for (var i = 0; i < arr.length; ++i) { @@ -34,7 +34,7 @@ window.setTimeout(function() { if (channel.onDeviceReady.state != 2) { console.log('deviceready has not fired after 5 seconds.'); - logUnfiredChannels(platfromInitChannels); + logUnfiredChannels(platformInitChannelsArray); logUnfiredChannels(channel.deviceReadyChannelsArray); } }, 5000); @@ -68,23 +68,25 @@ } /** - * Create all cordova objects once page has fully loaded and native side is ready. + * Create all cordova objects once native side is ready. */ channel.join(function() { - var platform = require('cordova/platform'); - // Call the platform-specific initialization - platform.initialize(); + require('cordova/platform').initialize(); // Fire event to notify that all objects are created channel.onCordovaReady.fire(); - // Fire onDeviceReady event once all constructors have run and - // cordova info has been received from native side. + // Fire onDeviceReady event once page has fully loaded, all + // constructors have run and cordova info has been received from native + // side. + // This join call is deliberately made after platform.initialize() in + // order that plugins may manipulate channel.deviceReadyChannelsArray + // if necessary. channel.join(function() { require('cordova').fireDocumentEvent('deviceready'); }, channel.deviceReadyChannelsArray); - }, platfromInitChannels); + }, platformInitChannelsArray); }(window));