JavaScript's Require

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JavaScript's Require

horrido
What is the best practice for using require()? Should it always be placed in index.html? Can it be placed in whatever class needs that particular JS library? If so, how? Direct JS inlining? Or is there an Amber way to do it?

Many questions. I need clarification. Thanks.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: JavaScript's Require

sebastianconcept
Hi Richard,

beside the initial load, flow uses require to lazily load templates, here you can see the method that invokes it:

to load html files it uses this require plugin

nothing would stop you from loading other libraries

A good question is if we could also use it to load other smalltalk packages so we can be lazy on that too, should be quite doable I expect



On Dec 22, 2014, at 10:50 PM, Richard Eng <[hidden email]> wrote:

What is the best practice for using require()? Should it always be placed in index.html? Can it be placed in whatever class needs that particular JS library? If so, how? Direct JS inlining? Or is there an Amber way to do it?

Many questions. I need clarification. Thanks.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: JavaScript's Require

Herby Vojčík
In reply to this post by horrido


Richard Eng wrote:
> *What is the best practice for using require()?* Should it always be
> placed in index.html? Can it be placed in whatever class needs that

If you do not want to load libraries dynamically in run-time (which also
help deploy builder to include all that is needed in deployment the.js),
the best way is just leave things as they are after amber init, and
specify addition external libraries that need to be loaded along an app
in deploy.js or devel.js, before the '// --- packages begin here ---'
line. Of course, those external libs need their mappings specified in
libdir.amd.json and `grunt devel` must be run afterwards, but those are
sort-of typical chores of 0.13+ project.

> particular JS library? If so, how? Direct JS inlining? Or is there an
> Amber way to do it?
>
> Many questions. I need clarification. Thanks.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.