Here is a pull request with a AMD-lite (well really CommonJS light) module manager: https://github.com/callback/callback-js/pull/16
We can dump this guy anywhere (cordova.require seemed to be the winning idea last I checked). This On Thu, Feb 9, 2012 at 12:07 PM, Filip Maj <[email protected]> wrote: > Three parts to this email. First: > > >[ Whole bunch of discussion] > > > >Perhaps it's time to define "AMD-lite" runtime somewhere? > > ^^ Pretty much. > > In my mind the simplest way to distill the discussion down is: do we want > to employ almond or some other AMD+CJS-compliant loaders, and make it > obvious to users that this comes with cordova, or roll our amdlite or smd > or whatever you want to call it, a cut-down version tailored for our > needs, and hide the fact we use it (closure that stuff up)? > > Second: > > One thing Mike and I chatted about today was the various platform > definition files - there being a common one and various platform-specific > ones, with both defining namespaces/globals that each will drop. It used a > JSON convention that currently is something like: > > > objects:{ > PhoneGap:{ > path:"lib/phonegap", > children:{ > exec:{ > path:"lib/phonegap/exec" > } > } > }, > navigator:{ > children:{ > accelerometer:{ > path: "lib/phonegap/plugin/accelerometer" > } > } > } > } > > I believe Pat expressed some form of disgust when he saw that :) I agree > it can certainly be better. One convention that could be employed is > having a string value instead of an object if it's a module path alone (no > children). Mike took it a different route and was thinking of something > string-based like: > > { > "window.PhoneGap":"lib/phonegap", > "window.PhoneGap.exec":"lib/phonegap/exec" > } > > Builder would need to be changed to accommodate the above, to sort the > namespace strings and build up the necessary parent object if they don't > exist, but both would work. Not sure if you recommended anything Pat but > it's certainly open to discussion. > > Third: > > I really want to ship cordova-js for 1.5. There is a lot that can be > improved, but I'm hoping that improvements can be slowly introduced over > the next few releases. I am hoping that none of the issues that you > brought up, Pat, are "show-stoppers". > > That's it from me. > > -- Gord Tanner Senior Developer / Code Poet tinyHippos Inc. @tinyhippos
