incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian LeRoux...@brian.io>
Subject Re: Unified phonegap javascript layer incorperating modules / plugins
Date Fri, 18 Nov 2011 07:50:42 GMT
This is a good discussion to have.

No technical benefit for an AMD approach since we have a compile step.
Arguably all JS apps should have a compile step and, shouldn't take an
AMD approach at all unless they are doing dynamic code loading. The
other issue, for our purposes, is some (tho not all) AMD style
compilers will end up w/ a larger footprint b/c of all the extra
ceremony. Not to mention more closure ceremony. We'd actually hurt
performance.

>From the aesthetics side, AMD is harder to read/write than a CommonJS
exports style.

>From a future proofing perspective Harmony Modules will support
CommonJS. Not that a rewrite is beyond our capacity but its nice to
know that once the lang supports modules our code should 'just work'.
I doubt that'll be the case but, hey, we can hope. I do know James
Burke, author of RequireJS AMD lib, is working towards a shim for
Harmony Modules but his work isn't complete yet.

So in short, CommonJS gives us:

- better performance
- better aesthetics
- closer to the future

+1 for AMD

(But pls do a prototype anyhow b/c I think it would be interesting for
us to contrast.)


On Fri, Nov 18, 2011 at 7:59 AM, Andrew Lunny <alunny@gmail.com> wrote:
> What's the reasoning behind developing this as a Node module?
>
> Node's great but I'm not sure if it's the best suited tool for this job -
> is it worth considering using AMD modules with existing script
> loaders/preprocessors? The JavaScript layer of PhoneGap/Callback is a
> client-side application, so I'd be in favour of going with the grain of
> existing client-side module solutions (requirejs, based on dojo modules,
> being the most prominent one).
>
> (hope to have some time to protoype something based on Gord's work, with
> AMD instead, in the next couple of weeks, but I'm curious what the other
> devs' thoughts are)
>
> On 17 November 2011 22:47, Dave Johnson <dave.c.johnson@gmail.com> wrote:
>
>> Awesome. Looking forward to working on this!
>>
>> -dave
>> On Nov 17, 2011 1:13 PM, "Gord Tanner" <gtanner@gmail.com> wrote:
>>
>> > Hello,
>> >
>> > I have put together a quick prototype to iron out some of the design
>> > choices I think would really help phonegap to get to a point where we
>> have
>> > one common javascript layer for all platforms.
>> >
>> > Source can be found here:
>> > https://github.com/gtanner/phonegap
>> >
>> > the HACKING file outlines key areas to focus on:
>> > https://github.com/gtanner/phonegap/blob/master/HACKING
>> >
>> > Key points:
>> >
>> > - All API definitions in phonegap should be plugins / modules.
>> > - In additional to being able to require in submodules, the existing
>> > phonegap APIs should still be injected.
>> > - There is one javascript project that is common across all platforms.
>> > -- Should allow for platform specific overrides
>> > -- Should allow for 3rd party modules to easily be included and used.
>> >
>> >
>> > Currently this has only been tested on Ripple (ripple.tinyhippos.com)
>> in a
>> > special prototype branch I wrote to emulate the native layer a little
>> > closer.  If you want to run it instructions can be found in the readme
>> > file:
>> > https://github.com/gtanner/phonegap/blob/master/README.md
>> >
>> >
>> > The plan is to further define this architecture and rapidly build out
>> more
>> > support next week and get it running on a few of the platforms.
>> >
>> > Cheers!
>> >
>> > -----
>> > Gord Tanner
>> > Code  Poet
>> > Research In Motion
>> >
>>
>

Mime
View raw message