[Sugar-devel] sugar-web - How to load non-AMD js modules / libs?

Code iraguet at activitycentral.com
Tue Nov 5 12:20:26 EST 2013


On Mon, Nov 4, 2013 at 1:54 PM, Manuel Quiñones <manuq at laptop.org> wrote:

> 2013/11/4 Code <iraguet at activitycentral.com>:
> > I think this is off-topic...
> > BTW: perhaps you wanna see this thread from RequireJS' list where James
> > Burke (core developer of RequireJS lib) talks about these syntax forms.
> > If there is something realted to this to add, would u open a new thread,
> > please?
> >
> >
> > Getting back to the former topic (loading non-AMD modules):
> > There is another approach, require.config() calls are additive, so it is
> > possible to call config from other file than loader.js and require merges
> > it.
> >
> > example of a require.config() from activity.js:
> > https://gist.github.com/code-sur/7305059  ...loader.js stills as it is
> in
> > sugar-web-template
> >
> > pros:
> > * no need to modify loader.js
> > * some developers would set other requirejs options
> >
> > cons:
> > * whole config may spreads among many files
> >
> > The last "con" may be a "pro" if you want to clearly separete the
> framework
> > config from the activity specific config
>
> Yeah.  I think it is up to the activity developer to choose one or the
> other.  The shim looks more prominent in RequireJS docs.
>
> Here is how I used the shim in Gears activity, just for reference:
> https://github.com/manuq/gears-activity/blob/master/js/loader.js
>
> By the way, I have talked with the developer of the lib involved,
> gearsketch, and he is happy if I provide a patch to make his code an
> AMD module.  In general I think its good to do this.
>
+1
I think that this is the right path, too, but I'm thinking from the point
of view of an occasional activity developer how just wants to build-up an
activity with his/her daily web tools.
I want to ease the work of activity devs... if it is somewhat hard to do,
they won't build anything.


I'd like to write a very tiny paragraph at the doc under the title of
"Using other JavaScript libraries" that tells you where to put the shim
config if you have any non-AMD module.
Seems weird to ask for putting shim config at loader.js and a few lines
above in the doc says that you shouldn't touch that file.

Code


> --
> .. manuq ..
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131105/4f514c5b/attachment.html>


More information about the Sugar-devel mailing list