From c7e105ee4254d00f591c4c002f32c223f4c2448a Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Mon, 4 Aug 2025 22:36:56 +0530 Subject: Add on_result callback for web.view.run_js --- lua/null-browser/api.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lua') 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('

HJello

') ---- web.view.set_html('

HJello

', 3) -- Set html for view with id 3 +--- web.view.set_html('

HJello

', { 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 -- cgit v1.3.1