From c4570be3b8b3428efb7ab70ec6875032d00ed95b Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Fri, 7 Feb 2020 19:20:14 +0200 Subject: DOCS: js: minor update for require --- DOCS/man/javascript.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DOCS/man/javascript.rst b/DOCS/man/javascript.rst index 0a43d213b6..786d2e076b 100644 --- a/DOCS/man/javascript.rst +++ b/DOCS/man/javascript.rst @@ -307,15 +307,15 @@ which ``require`` it. Otherwise it's considered a top-level id (CommonJS term). Top-level id is evaluated as absolute filesystem path if possible, e.g. ``/x/y`` or ``~/x``. Otherwise it's considered a global module id and searched according -``mp.module_paths`` in normal array order, e.g. ``require("x")`` tries to +to ``mp.module_paths`` in normal array order, e.g. ``require("x")`` tries to load ``x.js`` at one of the array paths, and id ``foo/x`` tries to load ``x.js`` inside dir ``foo`` at one of the paths. The ``mp.module_paths`` array is empty by default except for scripts which are -loaded as a directory where it contains one item - ``/modules/``. -``mp.module_paths`` may be updated from a script (preferably via custom init - -see below) which will affect future calls to ``require`` for global module id's -which are not already loaded/cached. +loaded as a directory where it contains one item - ``/modules/`` . +The array may be updated from a script (or using custom init - see below) which +will affect future calls to ``require`` for global module id's which are not +already loaded/cached. No ``global`` variable, but a module's ``this`` at its top lexical scope is the global object - also in strict mode. If you have a module which needs ``global`` -- cgit v1.2.3