cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Grieve (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-2531) CordovaCommandResult must be available to native before device ready.
Date Mon, 25 Feb 2013 15:40:13 GMT

    [ https://issues.apache.org/jira/browse/CB-2531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13585933#comment-13585933
] 

Andrew Grieve commented on CB-2531:
-----------------------------------

Hey Jesse,

Looking at bootstrap.js:

{code}
    /**
     * Create all cordova objects once page has fully loaded and native side is ready.
     */
    var joinEvents = [ channel.onDOMContentLoaded, channel.onNativeReady ];

    // If this property is set to something truthy, join on onPluginsReady too.
    // This property is set by the automatic JS installation prototype in cordova-cli,
    // and will be removed when the prototype either becomes mainline or is dropped.
    if (window.__onPluginsLoadedHack) {
        joinEvents.push(channel.onPluginsReady);
    }

    channel.join(function() {
        var builder = require('cordova/builder'),
            platform = require('cordova/platform');

        builder.buildIntoButDoNotClobber(platform.defaults, context);
        builder.buildIntoAndClobber(platform.clobbers, context);
        builder.buildIntoAndMerge(platform.merges, context);

        // Call the platform-specific initialization
        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.
        channel.join(function() {
            require('cordova').fireDocumentEvent('deviceready');
        }, channel.deviceReadyChannelsArray);

    }, joinEvents);

{code}

Builder & platform.initialize() come right after one-another, so moving from builder ->
platform.initialize shouldn't make a difference.

Maybe it not being available before nativeready is a pre-existing bug? It might make more
sense to put onNativeReady in the deviceReadyChannelsArray instead of waiting for it before
calling platform.initialize. WDYT?
                
> CordovaCommandResult must be available to native before device ready.
> ---------------------------------------------------------------------
>
>                 Key: CB-2531
>                 URL: https://issues.apache.org/jira/browse/CB-2531
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 2.5.0
>         Environment: WP7 + WP8
>            Reporter: Jesse MacFadyen
>            Assignee: Andrew Grieve
>            Priority: Blocker
>             Fix For: 2.5.0
>
>
> The commit: https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=commitdiff;h=c59a6b178a93c5108b2495a61a7f4922b4024024;hp=f88c86bea92b7061370c0e74ace1c9c69e36f2de
> Moves the creation of CordovaCommandResult to too late in the load cycle.
> This interface needs to be available to native before deviceready, so using platform.js
initialize is too late, and device ready cannot fire.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message