"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 -------------------------------- https://github.com/jrburke/almond/blob/master/almond.js 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 -------------------------------- https://github.com/jrburke/requirejs/blob/master/require.js 9 spec failures, similar to or same as the almond.js ones -------------------------------- testing dojo -------------------------------- http://dojotoolkit.org/download/ - Dojo Base 1.7.2 nothing works, for some reason "require" and "define" are not defined. -------------------------------- notes -------------------------------- - 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 http://muellerware.org
