1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 17:12:36 +00:00

javascript: add mp.del_property()

This commit is contained in:
rcombs 2022-12-16 15:23:29 -06:00
parent 51c6784df7
commit 94e1659b6c
2 changed files with 10 additions and 0 deletions

View File

@ -95,6 +95,8 @@ success, ``error`` is empty string on success.
``mp.abort_async_command(id)`` ``mp.abort_async_command(id)``
``mp.del_property(name)`` (LE)
``mp.get_property(name [,def])`` (LE) ``mp.get_property(name [,def])`` (LE)
``mp.get_property_osd(name [,def])`` (LE) ``mp.get_property_osd(name [,def])`` (LE)

View File

@ -698,6 +698,13 @@ static void script_get_property(js_State *J, void *af)
js_pushstring(J, res); js_pushstring(J, res);
} }
// args: name
static void script_del_property(js_State *J)
{
int e = mpv_del_property(jclient(J), js_tostring(J, 1));
push_status(J, e);
}
// args: name [,def] // args: name [,def]
static void script_get_property_bool(js_State *J) static void script_get_property_bool(js_State *J)
{ {
@ -1171,6 +1178,7 @@ static const struct fn_entry main_fns[] = {
AF_ENTRY(command_native, 2), AF_ENTRY(command_native, 2),
AF_ENTRY(_command_native_async, 2), AF_ENTRY(_command_native_async, 2),
FN_ENTRY(_abort_async_command, 1), FN_ENTRY(_abort_async_command, 1),
FN_ENTRY(del_property, 1),
FN_ENTRY(get_property_bool, 2), FN_ENTRY(get_property_bool, 2),
FN_ENTRY(get_property_number, 2), FN_ENTRY(get_property_number, 2),
AF_ENTRY(get_property_native, 2), AF_ENTRY(get_property_native, 2),