incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Mueller <pmue...@gmail.com>
Subject Re: Work Items for 1.5.0 - unified JS
Date Fri, 10 Feb 2012 11:00:49 GMT
On Thu, Feb 9, 2012 at 21:52, Gord Tanner <gord@tinyhippos.com> wrote:

> Here is a pull request with a AMD-lite (well really CommonJS light) module
> manager:
> https://github.com/callback/callback-js/pull/16


Wow, that's tiny!  Partially because it's require() doesn't handle relative
module id's.  :-)  We can add that back in; I like the idea of starting
small and then adding on when we have to.

We should probably pull in the CJS test cases - I have these floating
around somewhere.  And I think there are AMD test cases, but ... not sure
we really need them, since our "AMD" usage is pretty simplistic.


> We can dump this guy anywhere (cordova.require seemed to be the winning
> idea last I checked).
>

So, one thing I was thinking is that we may not actually want to keep a
require() in a global object like cordova.  The problem is, that require()
should only really be used from the "main" script.  Every module gets their
own instance of a require() function, which is customized to their module's
"path" (typically closed over a path variable - another fix needed for your
require).

If we have a "global" require hanging around, I have a feeling people may
be tempted to use it.  Which would be wrong, if they're already in a module
somewhere.

I think it's time to create a page on the Wiki, go over some of the options
w/r/t modules.

-- 
Patrick Mueller
http://muellerware.org

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