On 25 March 2012 03:07, Axel Rauschmayer <[email protected]> wrote:

> One thing that would be nice that we don't currently have is the ability
> to load modules relative to the calling web page.  This is an oversight in
> our loader.
>
>
> I'm curious: What is the use case for that?
>

The case where you have two web pages loading mutually-shared JS -- or even
one page using a lot of JS -- but not code you want to place in the
globally-available library directory for whatever reason.

We write web apps, and think of HTML files more or less as "programs".
Local-dir modules are like extra .o files in a C program.  Module-dir
modules are like libraries in /usr/lib.  The "main()" function is a module
contained within the HTML itself, usually between </body> and </html>.

Another use-case our loader doesn't address well is loading
dynamically-generated modules.  These are modules whose source code is
generated on the fly for whatever reason (e.g. they might emit information
from a database, crypto secrets, etc.).  We have to do either

require("../../methods/module")   /* brittle */
or
require("/" + window.location.hostname + "/methods/module")  /* annoying */

Wes

-- 
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to