From 71ddb22b39ec3cce1c39b7f53975e51e94d257d4 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Sat, 21 Dec 2019 12:13:15 +0200 Subject: js: read_options: support on_update (match 478a321d) This is a bit different than the lua code: on script-opts change it simply re-applies the conf-file and script-opts to the options object, and if this results in any changed value at options then on_update is called with the changelist as argument. This allows a value to revert back to the conf-file value if the matching script-opts key had a different value and then got deleted. It also guarantees to call back whenever the options object is modified, which the lua code doesn't do (e.g. if the caller changed a value and the observer changed it back - it won't detect a change). --- DOCS/man/javascript.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'DOCS') diff --git a/DOCS/man/javascript.rst b/DOCS/man/javascript.rst index c0c4dbad8c..8e3e7d6199 100644 --- a/DOCS/man/javascript.rst +++ b/DOCS/man/javascript.rst @@ -187,7 +187,8 @@ success, ``fn`` is called always a-sync, ``error`` is empty string on success. ``mp.add_hook(type, priority, fn)`` -``mp.options.read_options(obj [, identifier])`` (types: string/boolean/number) +``mp.options.read_options(obj [, identifier [, on_update]])`` (types: +string/boolean/number, ``on_update`` does re-read the config file) Additional utilities -------------------- -- cgit v1.2.3