File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,19 @@ pub(crate) struct StoredVirtualMachine {
2323 held_objects : RefCell < Vec < PyObjectRef > > ,
2424}
2525
26+ #[ pymodule]
27+ mod _window { }
28+
29+ fn init_window_module ( vm : & VirtualMachine ) -> PyObjectRef {
30+ let module = _window:: make_module ( vm) ;
31+
32+ extend_module ! ( vm, module, {
33+ "window" => js_module:: PyJsValue :: new( wasm_builtins:: window( ) ) . into_ref( vm) ,
34+ } ) ;
35+
36+ module
37+ }
38+
2639impl StoredVirtualMachine {
2740 fn new ( id : String , inject_browser_module : bool ) -> StoredVirtualMachine {
2841 let mut scope = None ;
@@ -31,11 +44,6 @@ impl StoredVirtualMachine {
3144
3245 js_module:: setup_js_module ( vm) ;
3346 if inject_browser_module {
34- fn init_window_module ( vm : & VirtualMachine ) -> PyObjectRef {
35- py_module ! ( vm, "_window" , {
36- "window" => js_module:: PyJsValue :: new( wasm_builtins:: window( ) ) . into_ref( vm) ,
37- } )
38- }
3947 vm. add_native_module ( "_window" . to_owned ( ) , Box :: new ( init_window_module) ) ;
4048 setup_browser_module ( vm) ;
4149 }
You can’t perform that action at this time.
0 commit comments