cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Mueller <>
Subject using existing AMD implementations with cordova.js
Date Wed, 22 Feb 2012 18:28:19 GMT
"good news everyone"

Just concluded a little experiment to see what happens if we replace the
require.js from cordova-js, with

- almond
- requirejs
- dojo

testing almond

add "define.unordered = true" at the bottom of the file to make this work

9 spec failures, all related to require() semantics only

testing requirejs

9 spec failures, similar to or same as the almond.js ones

testing dojo
-------------------------------- - Dojo Base 1.7.2

nothing works, for some reason "require" and "define" are not defined.


- great to see this works, mostly, with at least almond and requirejs.
 We'll need some dojo mojo to figure out what's happening with dojo.

- our require.js adds a "define.remove()" function which no one else
implements.  I'm happy with that, but we should probably make the tests
sensitive to it - only do the "remove" tests if "define.remove()" is present

- issues w/almond and requirejs not throwing exceptions when modules are
multiply defined or missing for require().  I've noted this issue with
almond before, and there's an open bug at almond for it.  Seems like
requirejs is also not doing this.  For this reason alone, I'd recommend
folks not use almond or requirejs as difficult-to-diagnose failures will
occur if, for some reason, a required module is absent.

- the results above were for `jake btest`

- `jake test` fails on all of these due to various sorts of "location",
"navigator", etc not found.  Not quite sure what to do about this, may not
be worth the time to get these "working".

- not quite sure about the best approach to allowing someone to replace our
define() and require() with a different one.  It might be nice if our
implementation just deferred to the existing one (didn't 'install' itself)
if it recognized one was already there - that seems to be the typical
approach with this.  Alternatively, we could build the 'cordova.js' WITHOUT
our require.js in it.

Patrick Mueller

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message