aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-04-12 11:56:10 +0530
committerAkshay Nair <phenax5@gmail.com>2025-04-12 11:56:35 +0530
commitf3f109cd054888f857d51ca2b37b4123f3134069 (patch)
tree81250db8a30f85d34d3c101830a37e3535e77054 /lua
parentc0ee5203201d4ddf4ed560f856cb0da958935fc6 (diff)
downloadnull-browser-f3f109cd054888f857d51ca2b37b4123f3134069.tar.gz
null-browser-f3f109cd054888f857d51ca2b37b4123f3134069.zip
Add configuration api
Diffstat (limited to '')
-rw-r--r--lua/null-browser/api.lua25
1 files changed, 25 insertions, 0 deletions
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")