diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-02-07 19:20:14 +0200 |
---|---|---|
committer | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-02-07 19:24:00 +0200 |
commit | c4570be3b8b3428efb7ab70ec6875032d00ed95b (patch) | |
tree | 95424b5dcd19f72d2f034a2acd81d5fac51c174a /DOCS | |
parent | 756960bf3cd6110c85b97f3edbd3bf0e2a2b91d4 (diff) | |
download | mpv-c4570be3b8b3428efb7ab70ec6875032d00ed95b.tar.bz2 mpv-c4570be3b8b3428efb7ab70ec6875032d00ed95b.tar.xz |
DOCS: js: minor update for require
Diffstat (limited to 'DOCS')
-rw-r--r-- | DOCS/man/javascript.rst | 10 |
1 files 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 - ``<directory>/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 - ``<directory>/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`` |