File tree 1 file changed +33
-1
lines changed
1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,41 @@ pub mod pages;
6
6
7
7
use wasm_bindgen:: prelude:: wasm_bindgen;
8
8
9
+ #[ wasm_bindgen]
10
+ extern "C" {
11
+ #[ wasm_bindgen( js_namespace = console) ]
12
+ fn log ( msg : String ) ;
13
+
14
+ #[ wasm_bindgen( js_namespace = console) ]
15
+ fn warn ( msg : String ) ;
16
+
17
+ #[ wasm_bindgen( js_namespace = console) ]
18
+ fn error ( msg : String ) ;
19
+ }
20
+
21
+ #[ macro_export]
22
+ macro_rules! log {
23
+ ( $( $t: tt) * ) => {
24
+ if cfg!( debug_assertions) {
25
+ log( format_args!( $( $t) * ) . to_string( ) )
26
+ }
27
+ }
28
+ }
29
+
30
+ #[ macro_export]
31
+ macro_rules! warn {
32
+ ( $( $t: tt) * ) => ( warn( format_args!( $( $t) * ) . to_string( ) ) )
33
+ }
34
+
35
+ #[ macro_export]
36
+ macro_rules! error {
37
+ ( $( $t: tt) * ) => ( error( format_args!( $( $t) * ) . to_string( ) ) )
38
+ }
39
+
9
40
#[ wasm_bindgen]
10
41
pub fn hydrate ( ) {
11
- console_error_panic_hook:: set_once ( ) ;
42
+ #[ cfg( target_arch = "wasm32" ) ]
43
+ std:: panic:: set_hook ( Box :: new ( |info : & std:: panic:: PanicInfo | error ! ( "{info}" ) ) ) ;
12
44
13
45
leptos:: leptos_dom:: HydrationCtx :: stop_hydrating ( ) ;
14
46
}
You can’t perform that action at this time.
0 commit comments