Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #39714
| Path | csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Anton Shepelev <anton.txt@gmail.com> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Exposing a module in the current scope |
| Date | Sat, 20 Mar 2021 13:32:25 +0300 |
| Organization | A noiseless patient Spider |
| Lines | 45 |
| Message-ID | <20210320133225.dc6d7e29282d899560acbea6@gmail.com> (permalink) |
| References | <20210318192107.08e2fac2d6aeada5596c4dd0@freeshell.de> <7921cdf5-084a-4011-9a0e-680e0b45c442n@googlegroups.com> <20210318235703.ea4798e2fc9d01b5194a34ca@gmail.com> <5a31706e-e012-47ea-b047-867d6da83212n@googlegroups.com> <20210319181117.c09ff1a07699679434f6310e@g{oogle}mail.com> <20210319190840.d8394a52d55a822870195dff@g{oogle}mail.com> <fe0e4f34-41be-4e39-97b1-4779df01108cn@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | reader02.eternal-september.org; posting-host="0b6de666454792515201e0a3034742c6"; logging-data="26877"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19LNJ4JHzhdE5Lf64dPfpK/e0yFTyeDy8A=" |
| Cancel-Lock | sha1:LmKagojKi+PYIIq99h355sg6PDY= |
| X-Newsreader | Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) |
| Xref | csiph.com comp.lang.javascript:39714 |
Show key headers only | View raw
Michael Haufe:
> No, I just don't know how the platform's import mechanism
> works. The modern standard is for the importing code to
> dictate the name and not the module itself.
>
> Does `$.import(...);` return a value, or is it only a
> side-effect?
I quoted a working example in the initial post:
$.import("anton_test/util.xsjslib","util"); // import module
$.anton_test.util.log("Log from library."); // invoke a function
Futhermore, a couple of posts above I provided a working
example of a library and its usage:
> // file util.xsjslib:
> function log(msg)
> { $.trace.debug(msg); };
>
> I can use like this:
>
> var log;
> $.import("anton_test/util.xsjslib","util");
> ({log} = $.anton_test.util);
> log("Hello.");
You can also see the official documentation:
Using Server-Side JavaScript Libraries:
https://help.sap.com/viewer/d89d4595fae647eabc14002c0340a999/1.0.12/en-US/8a9cdd1242654ccd86ba113630e77830.html
As I understand from all of the above, it is a side effect.
> The modern standard is for the importing code to dictate
> the name and not the module itself.
Do you mean CommonJS modules (require) or ECAMScript modules
(import)? I think they both accept the name of the module
being imported.
--
() ascii ribbon campaign -- against html e-mail
/\ http://preview.tinyurl.com/qcy6mjc [archived]
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Exposing a module in the current scope Anton Shepelev <antonius@freeshell.de> - 2021-03-18 19:21 +0300
Re: Exposing a module in the current scope Anton Shepelev <anton.txt@gmail.com> - 2021-03-18 23:57 +0300
Re: Exposing a module in the current scope "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-18 18:45 -0700
Re: Exposing a module in the current scope Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-03-19 18:11 +0300
Re: Exposing a module in the current scope Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-03-19 19:08 +0300
Re: Exposing a module in the current scope "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-19 10:51 -0700
Re: Exposing a module in the current scope Anton Shepelev <anton.txt@gmail.com> - 2021-03-20 13:32 +0300
Re: Exposing a module in the current scope "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-20 09:53 -0700
Re: Exposing a module in the current scope "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-19 10:47 -0700
Re: Exposing a module in the current scope Anton Shepelev <anton.txt@gmail.com> - 2021-03-20 13:51 +0300
Re: Exposing a module in the current scope "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-20 09:59 -0700
Re: Exposing a module in the current scope Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-03-24 20:43 +0300
Re: Exposing a module in the current scope Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-22 21:14 +0100
Re: Exposing a module in the current scope "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-22 16:00 -0700
Re: Exposing a module in the current scope Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-23 01:11 +0100
Re: Exposing a module in the current scope Anton Shepelev <anton.txt@gmail.com> - 2021-04-04 00:31 +0300
Re: Exposing a module in the current scope "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-18 11:30 -0700
Re: Exposing a module in the current scope Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-22 21:05 +0100
Re: Exposing a module in the current scope Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-23 01:00 +0100
Re: Exposing a module in the current scope Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-03-23 20:06 +0300
Re: Exposing a module in the current scope Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-25 20:04 +0100
Re: Exposing a module in the current scope John G Harris <niam@jghnorth.org.uk.invalid> - 2021-03-26 08:32 +0000
Re: Exposing a module in the current scope John G Harris <niam@jghnorth.org.uk.invalid> - 2021-03-26 08:48 +0000
Re: Exposing a module in the current scope Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-04-13 18:49 +0300
csiph-web