From f3f109cd054888f857d51ca2b37b4123f3134069 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 12 Apr 2025 11:56:10 +0530 Subject: Add configuration api --- lua/null-browser/api.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lua') diff --git a/lua/null-browser/api.lua b/lua/null-browser/api.lua index 3949fbc..7d61344 100644 --- a/lua/null-browser/api.lua +++ b/lua/null-browser/api.lua @@ -45,4 +45,29 @@ function web.event.add_listener(events, opts) return __internals.register_event(opts) end +--- Set configuration options +--- +--- @param key string The name of the configuration +--- @param value string|boolean|number Configuration value +--- +--- @example +--- ```lua +--- web.set('new_view_url', 'https://duckduckgo.com') +--- ``` +function web.set(key, value) + __internals.set_config(key, value) +end + +--- Get configuration value +--- +--- @param key string The name of the configuration +--- +--- @example +--- ```lua +--- local url = web.get('new_view_url') +--- ``` +function web.get(key) + return __internals.get_config(key) +end + print("api loaded") -- cgit v1.3.1