Path: csiph.com!3.eu.feeder.erje.net!feeder.erje.net!feeds.phibee-telecom.net!news.mixmin.net!aioe.org!CCMkyJEHTgBdcCrD/8Vr8g.user.gioia.aioe.org.POSTED!not-for-mail From: Anton Shepelev Newsgroups: comp.lang.javascript Subject: Exposing a module in the current scope Date: Thu, 18 Mar 2021 19:21:07 +0300 Organization: Aioe.org NNTP Server Lines: 21 Message-ID: <20210318192107.08e2fac2d6aeada5596c4dd0@freeshell.de> NNTP-Posting-Host: CCMkyJEHTgBdcCrD/8Vr8g.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org Keywords: 851906414 X-Newsreader: Sylpheed 3.5.0 (GTK+ 2.24.23; i686-pc-mingw32) X-Notice: Filtered by postfilter v. 0.9.2 Xref: csiph.com comp.lang.javascript:39693 Hello, all It looks like in the system for which I need to write server-side JavaScript, neither CommonJS nor ECMAScript modules are supported, but it provides its own module system that works as shown below: $.import("anton_test/util.xsjslib","util"); // import module $.anton_test.util.log("Log from library."); // invoke a function Is it somehow possible to have all the functions from `util' available in the current scope, so that I could invoke them by their names: log("Hello"), rather than, say, util.log("Hello"), without enumerating them in a destucturing assignment. If analogies with other languages can help, then it would be like `uses` in Borland Pascal, `using static` in C#, or `#include` in C. -- () ascii ribbon campaign - against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]