aboutsummaryrefslogtreecommitdiff
path: root/src/LuaRuntimeApi.hpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-04-19 18:43:32 +0530
committerAkshay Nair <phenax5@gmail.com>2025-04-19 18:44:07 +0530
commita9d767b209c503ac7b5dff5132aa213d47dcb608 (patch)
tree6b5625c546ca24fd40e8d6f8306cc7b60713e4cc /src/LuaRuntimeApi.hpp
parent0e95e99e72237058465959d55b77750a9d7c1bef (diff)
downloadnull-browser-a9d767b209c503ac7b5dff5132aa213d47dcb608.tar.gz
null-browser-a9d767b209c503ac7b5dff5132aa213d47dcb608.zip
Add web.view.open_devtools for opening devtools
Diffstat (limited to 'src/LuaRuntimeApi.hpp')
-rw-r--r--src/LuaRuntimeApi.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/LuaRuntimeApi.hpp b/src/LuaRuntimeApi.hpp
index b6302ff..ff2f46c 100644
--- a/src/LuaRuntimeApi.hpp
+++ b/src/LuaRuntimeApi.hpp
@@ -209,6 +209,13 @@ int lua_api_search_previous(lua_State *state) {
return 1;
}
+int lua_api_view_open_devtools(lua_State *state) {
+ WebViewId view_id = lua_isnoneornil(state, 1) ? 0 : lua_tointeger(state, 1);
+ auto &runtime = LuaRuntime::instance();
+ emit runtime.devtools_requested(view_id);
+ return 1;
+}
+
// NOLINTNEXTLINE
static luaL_Reg internals_api[] = {
luaL_Reg{"event_add_listener", &lua_event_register},
@@ -226,5 +233,6 @@ static luaL_Reg internals_api[] = {
luaL_Reg{"search_set_text", &lua_api_search_set_text},
luaL_Reg{"search_previous", &lua_api_search_previous},
luaL_Reg{"search_next", &lua_api_search_next},
+ luaL_Reg{"view_open_devtools", &lua_api_view_open_devtools},
luaL_Reg{nullptr, nullptr},
};