From 8604765c3660dbea9cae6996d5750bfb985e6751 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 27 Jul 2025 20:21:07 +0530 Subject: Add web.view.run_js + change rpc js api --- src/widgets/WebViewStack.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/widgets/WebViewStack.cpp') diff --git a/src/widgets/WebViewStack.cpp b/src/widgets/WebViewStack.cpp index 0ed2399..37532ff 100644 --- a/src/widgets/WebViewStack.cpp +++ b/src/widgets/WebViewStack.cpp @@ -342,6 +342,16 @@ void WebViewStack::set_html(const QString &html, WebViewId webview_id) { webview->setHtml(html); } +void WebViewStack::run_javascript(const QString &js_code, WebViewId webview_id) { + auto *webview = get_webview(webview_id); + if (webview == nullptr) { + qDebug() << "Webview does not exist"; + return; + } + + webview->run_javascript(js_code); +} + void WebViewStack::expose_rpc_function(const QString &name, const RpcFunc & /* unused */, WebViewId /* unused */) { qDebug() << "expose_rpc_function: NOT IMPLEMENTED" << name; -- cgit v1.3.1