This repository was archived by the owner on Jun 18, 2021. It is now read-only.
File tree 6 files changed +25
-46
lines changed
6 files changed +25
-46
lines changed Original file line number Diff line number Diff line change @@ -114,19 +114,16 @@ async fn run() {
114
114
}
115
115
}
116
116
117
- #[ cfg( target_arch = "wasm32" ) ]
118
- #[ cfg_attr( target_arch = "wasm32" , wasm_bindgen:: prelude:: wasm_bindgen( start) ) ]
119
- pub fn wasm_main ( ) {
120
- console_log:: init ( ) . expect ( "could not initialize log" ) ;
121
- std:: panic:: set_hook ( Box :: new ( console_error_panic_hook:: hook) ) ;
122
- wasm_bindgen_futures:: spawn_local ( run ( ) ) ;
123
- }
124
-
125
- #[ cfg( target_arch = "wasm32" ) ]
126
- fn main ( ) { }
127
-
128
- #[ cfg( not( target_arch = "wasm32" ) ) ]
129
117
fn main ( ) {
130
- env_logger:: init ( ) ;
131
- futures:: executor:: block_on ( run ( ) ) ;
118
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
119
+ {
120
+ env_logger:: init ( ) ;
121
+ futures:: executor:: block_on ( run ( ) ) ;
122
+ }
123
+ #[ cfg( target_arch = "wasm32" ) ]
124
+ {
125
+ std:: panic:: set_hook ( Box :: new ( console_error_panic_hook:: hook) ) ;
126
+ console_log:: init ( ) . expect ( "could not initialize logger" ) ;
127
+ wasm_bindgen_futures:: spawn_local ( run ( ) ) ;
128
+ }
132
129
}
Original file line number Diff line number Diff line change @@ -23,12 +23,7 @@ fn main() {
23
23
#[ cfg( target_arch = "wasm32" ) ]
24
24
{
25
25
std:: panic:: set_hook ( Box :: new ( console_error_panic_hook:: hook) ) ;
26
+ console_log:: init ( ) . expect ( "could not initialize logger" ) ;
26
27
wasm_bindgen_futures:: spawn_local ( run ( ) ) ;
27
28
}
28
29
}
29
-
30
- #[ cfg( target_arch = "wasm32" ) ]
31
- #[ cfg_attr( target_arch = "wasm32" , wasm_bindgen:: prelude:: wasm_bindgen( start) ) ]
32
- pub fn wasm_main ( ) {
33
- main ( ) ;
34
- }
Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ pub fn run<E: Example>(title: &str) {
159
159
#[ cfg( target_arch = "wasm32" ) ]
160
160
{
161
161
std:: panic:: set_hook ( Box :: new ( console_error_panic_hook:: hook) ) ;
162
+ console_log:: init ( ) . expect ( "could not initialize logger" ) ;
162
163
use winit:: platform:: web:: WindowExtWebSys ;
163
164
// On wasm, append the canvas to the document body
164
165
web_sys:: window ( )
Original file line number Diff line number Diff line change @@ -124,21 +124,18 @@ async fn execute_gpu(numbers: Vec<u32>) -> Vec<u32> {
124
124
}
125
125
}
126
126
127
- #[ cfg( target_arch = "wasm32" ) ]
128
- #[ cfg_attr( target_arch = "wasm32" , wasm_bindgen:: prelude:: wasm_bindgen( start) ) ]
129
- pub fn wasm_main ( ) {
130
- console_log:: init ( ) . expect ( "could not initialize log" ) ;
131
- std:: panic:: set_hook ( Box :: new ( console_error_panic_hook:: hook) ) ;
132
- wasm_bindgen_futures:: spawn_local ( run ( ) ) ;
133
- }
134
-
135
- #[ cfg( target_arch = "wasm32" ) ]
136
- fn main ( ) { }
137
-
138
- #[ cfg( not( target_arch = "wasm32" ) ) ]
139
127
fn main ( ) {
140
- env_logger:: init ( ) ;
141
- futures:: executor:: block_on ( run ( ) ) ;
128
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
129
+ {
130
+ env_logger:: init ( ) ;
131
+ futures:: executor:: block_on ( run ( ) ) ;
132
+ }
133
+ #[ cfg( target_arch = "wasm32" ) ]
134
+ {
135
+ std:: panic:: set_hook ( Box :: new ( console_error_panic_hook:: hook) ) ;
136
+ console_log:: init ( ) . expect ( "could not initialize logger" ) ;
137
+ wasm_bindgen_futures:: spawn_local ( run ( ) ) ;
138
+ }
142
139
}
143
140
144
141
#[ cfg( test) ]
Original file line number Diff line number Diff line change @@ -137,12 +137,6 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
137
137
} ) ;
138
138
}
139
139
140
- #[ cfg( target_arch = "wasm32" ) ]
141
- #[ cfg_attr( target_arch = "wasm32" , wasm_bindgen:: prelude:: wasm_bindgen( start) ) ]
142
- pub fn wasm_main ( ) {
143
- main ( ) ;
144
- }
145
-
146
140
fn main ( ) {
147
141
let event_loop = EventLoop :: new ( ) ;
148
142
let window = winit:: window:: Window :: new ( & event_loop) . unwrap ( ) ;
@@ -154,6 +148,7 @@ fn main() {
154
148
#[ cfg( target_arch = "wasm32" ) ]
155
149
{
156
150
std:: panic:: set_hook ( Box :: new ( console_error_panic_hook:: hook) ) ;
151
+ console_log:: init ( ) . expect ( "could not initialize logger" ) ;
157
152
use winit:: platform:: web:: WindowExtWebSys ;
158
153
// On wasm, append the canvas to the document body
159
154
web_sys:: window ( )
Original file line number Diff line number Diff line change @@ -268,12 +268,6 @@ impl framework::Example for Example {
268
268
}
269
269
}
270
270
271
- #[ cfg( target_arch = "wasm32" ) ]
272
- #[ cfg_attr( target_arch = "wasm32" , wasm_bindgen:: prelude:: wasm_bindgen( start) ) ]
273
- pub fn wasm_main ( ) {
274
- main ( ) ;
275
- }
276
-
277
271
fn main ( ) {
278
272
framework:: run :: < Example > ( "msaa-line" ) ;
279
273
}
You can’t perform that action at this time.
0 commit comments