We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 56bcb02 commit 93cdd94Copy full SHA for 93cdd94
wasm/lib/src/browser.py
@@ -0,0 +1,12 @@
1
+from _browser import *
2
+from _js import JsValue
3
+from _window import window
4
+
5
6
+_alert = window.get_prop("alert")
7
8
9
+def alert(msg):
10
+ if type(msg) != str:
11
+ raise TypeError("msg must be a string")
12
+ _alert.call(JsValue.fromstr(msg))
wasm/lib/src/browser_module.rs
@@ -418,5 +418,9 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
418
pub fn setup_browser_module(vm: &VirtualMachine) {
419
vm.stdlib_inits
420
.borrow_mut()
421
- .insert("browser".to_string(), Box::new(make_module));
+ .insert("_browser".to_string(), Box::new(make_module));
422
+ vm.frozen.borrow_mut().insert(
423
+ "browser".to_string(),
424
+ py_compile_bytecode!(file = "src/browser.py"),
425
+ );
426
}
0 commit comments