MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / run_js

Function run_js

pywebio/session/__init__.py:340–354  ·  view source on GitHub ↗

Execute JavaScript code in user browser. The code is run in the browser's JS global scope. :param str code_: JavaScript code :param args: Local variables passed to js code. Variables need to be JSON-serializable. Example:: run_js('console.log(a + b)', a=1, b=2)

(code_, **args)

Source from the content-addressed store, hash-verified

338
339
340def run_js(code_, **args):
341 """Execute JavaScript code in user browser.
342
343 The code is run in the browser's JS global scope.
344
345 :param str code_: JavaScript code
346 :param args: Local variables passed to js code. Variables need to be JSON-serializable.
347
348 Example::
349
350 run_js('console.log(a + b)', a=1, b=2)
351
352 """
353 from ..io_ctrl import send_msg
354 send_msg('run_script', spec=dict(code=code_, args=args))
355
356
357@chose_impl

Callers 12

targetFunction · 0.90
on_key_pressFunction · 0.90
targetFunction · 0.85
playgroundFunction · 0.85
copytoclipboardFunction · 0.85
handle_codeFunction · 0.85
set_progressbarFunction · 0.85
datatable_updateFunction · 0.85
datatable_insertFunction · 0.85
datatable_removeFunction · 0.85
on_task_exceptionMethod · 0.85
go_appFunction · 0.85

Calls 1

send_msgFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…