diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-08-04 22:36:56 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-08-04 22:36:56 +0530 |
| commit | c7e105ee4254d00f591c4c002f32c223f4c2448a (patch) | |
| tree | 17ebadd5dc1a5e148c4b2f5ed1c70b7c7e54fe1a /lua | |
| parent | 0d1258aee3f39c8d5348588a87e804ec8cd27bd5 (diff) | |
| download | null-browser-c7e105ee4254d00f591c4c002f32c223f4c2448a.tar.gz null-browser-c7e105ee4254d00f591c4c002f32c223f4c2448a.zip | |
Add on_result callback for web.view.run_js
Diffstat (limited to '')
| -rw-r--r-- | lua/null-browser/api.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lua/null-browser/api.lua b/lua/null-browser/api.lua index 65a7663..e1f2acc 100644 --- a/lua/null-browser/api.lua +++ b/lua/null-browser/api.lua @@ -125,14 +125,15 @@ function web.view.set_url(url, view_id) return __internals.view_set_url(url, vie --- @example --- ```lua --- web.view.set_html('<h2>HJello</h2>') ---- web.view.set_html('<h2>HJello</h2>', 3) -- Set html for view with id 3 +--- web.view.set_html('<h2>HJello</h2>', { view = 3 }) -- Set html for view with id 3 --- ``` function web.view.set_html(html, opts) return __internals.view_set_html(html, (opts or {}).view) end --- @class RunJSOpts --- @field view? number View id +--- @field on_result fun(v: any): nil Callback when ---- Run js in a given view +--- Run js in a view --- --- @param js string HTML string --- @param opts? RunJSOpts Options @@ -140,9 +141,9 @@ function web.view.set_html(html, opts) return __internals.view_set_html(html, (o --- @example --- ```lua --- web.view.run_js('console.log(42)') ---- web.view.run_js('console.log(42)', 3) -- Set html for view with id 3 +--- web.view.run_js('console.log(42)', { view = 3 }) -- Set html for view with id 3 --- ``` -function web.view.run_js(js, opts) return __internals.view_run_js(js, (opts or {}).view) end +function web.view.run_js(js, opts) return __internals.view_run_js(js, opts or {}) end --- @class ReloadOpts --- @field view? number View id |
