incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filip Maj (Resolved) (JIRA)" <>
Subject [jira] [Resolved] (CB-499) Cordova 1.6 breaks with RequireJS
Date Mon, 16 Apr 2012 20:50:19 GMT


Filip Maj resolved CB-499.

    Resolution: Won't Fix

If I understand correctly, you guys are not using the cordova.js file properly. You do not

<script src="cordova.js"></script> 

... as the first script tag in your HTML page, but rather somehow wrap the the loading of
cordova.js in a require call.

Currently it is not possible to load in cordova.js via a require call, as cordova needs to
hijack a bunch of DOM methods (such as {{document.addEventListener}}) to provide its hooks
for events such as {{deviceready}} (among other things).

Instead of using the approach you are for this issue, include cordova.js as the top-level
script tag, and then include requirejs, and any other scripts/modules, as you would normally.
It is *imperative* that cordova.js be the first script tag though. Related to this, there's
no reason to asynchronously load in cordova.js in the WebView: you have a compile step for
native apps anyways, you know ahead of time that you, at the very minimum, _need_ cordova.js
in the HTML page of your app.

Bottom line: cordova doesn't BREAK requirejs, you are just using cordova INSIDE of requirejs
for no real reason. If you can prove that this is an important use case to cover, then we
should reconsider re-opening this issue, but cordova applications are not completely analogous
to web applications, where asynchronous loading of *all* scripts is an actual use case. If
you are building a cordova application, you _know_ you _need_ to have cordova.js included
anyways, and it's included in your application package, so you do not (and actually should
not) load it in asynchronously.
> Cordova 1.6 breaks with RequireJS
> ---------------------------------
>                 Key: CB-499
>                 URL:
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 1.6.0
>         Environment: Android, Cordova 1.6.0, RequireJS 1.0.7
>            Reporter: Dewang Shah
>            Assignee: Filip Maj
> Cordova 1.6 breaks compatibility with RequireJS. This uesd to work in 1.5 but now stops
all other Require modules from loading. The deviceready event fires within seconds (much sooner
that 1.5) and then all modules fail to load.
> Making Cordova the last module to load does not make any difference.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message