diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-02-07 17:35:48 +0200 |
---|---|---|
committer | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-02-07 18:22:12 +0200 |
commit | 756960bf3cd6110c85b97f3edbd3bf0e2a2b91d4 (patch) | |
tree | 004dd368108cf52d8d73964f91a8ae7d86100437 /DOCS | |
parent | 68a1b47d4d4a7d59d4f43850902d4194eb7c0552 (diff) | |
download | mpv-756960bf3cd6110c85b97f3edbd3bf0e2a2b91d4.tar.bz2 mpv-756960bf3cd6110c85b97f3edbd3bf0e2a2b91d4.tar.xz |
js: require: directory-scripts: first look at <dir>/modules/
Also, add the function mp.get_script_directory() to let scripts know if
they're loaded as a directory and where.
Diffstat (limited to 'DOCS')
-rw-r--r-- | DOCS/interface-changes.rst | 2 | ||||
-rw-r--r-- | DOCS/man/javascript.rst | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 3e0347bc7f..efbfdc510e 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -28,6 +28,8 @@ Interface changes - directories in ~/.mpv/scripts/ (or equivalent) now have special semantics (see mpv Lua scripting docs) - names starting with "." in ~/.mpv/scripts/ (or equivalent) are now ignored + - js modules: ~~/scripts/modules.js/ is no longer used, global paths can be + set with custom init (see docs), dir-scripts first look at <dir>/modules/ --- mpv 0.32.0 --- - change behavior when using legacy option syntax with options that start with two dashes (``--`` instead of a ``-``). Now, using the recommended diff --git a/DOCS/man/javascript.rst b/DOCS/man/javascript.rst index 49ddb481e4..0a43d213b6 100644 --- a/DOCS/man/javascript.rst +++ b/DOCS/man/javascript.rst @@ -139,6 +139,8 @@ success, ``fn`` is called always a-sync, ``error`` is empty string on success. ``mp.get_script_name()`` +``mp.get_script_directory()`` + ``mp.osd_message(text [,duration])`` ``mp.get_wakeup_pipe()`` @@ -309,7 +311,8 @@ or ``~/x``. Otherwise it's considered a global module id and searched according 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. +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. |