mirror of https://github.com/mpv-player/mpv
de0849404b
mp.observe_property('foo', nil, ...) calls the handler at least 2 times
on each playlist change even when the property doesn't change. This is
dangerous because if you haven't read observe_property's documentation
in a long time this is easy to forget, and you can end up using it for
handlers that are computationally expensive or that cause unintended
side effects.
Therefore, this commit discourages its use more explicitly in the
documentation, and replaces its usages in scripts.
For console.lua, observing focused with type nil leads to calling
mp.osd_message('') when changing file while playing in the terminal with
the console disabled. I don't notice issues from this, but it's safer to
avoid it.
For playlist and track-list this doesn't really matter since they
trigger multiple changes on each new file anyway, but changing it can
avoid encouraging people to imitate the code.
One usage of none in stats.lua is kept because according to
|
||
---|---|---|
.. | ||
af.rst | ||
ao.rst | ||
changes.rst | ||
console.rst | ||
encode.rst | ||
input.rst | ||
ipc.rst | ||
javascript.rst | ||
libmpv.rst | ||
lua.rst | ||
mpv.rst | ||
options.rst | ||
osc.rst | ||
stats.rst | ||
vf.rst | ||
vo.rst |