diff options
Diffstat (limited to 'examples/wasm/src')
| -rw-r--r-- | examples/wasm/src/lib.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/examples/wasm/src/lib.rs b/examples/wasm/src/lib.rs index 0aa32a70b..61757ebd7 100644 --- a/examples/wasm/src/lib.rs +++ b/examples/wasm/src/lib.rs | |||
| @@ -1,10 +1,8 @@ | |||
| 1 | #![feature(type_alias_impl_trait)] | 1 | #![feature(type_alias_impl_trait)] |
| 2 | #![allow(incomplete_features)] | 2 | #![allow(incomplete_features)] |
| 3 | 3 | ||
| 4 | use embassy::{ | 4 | use embassy::executor::Spawner; |
| 5 | executor::Spawner, | 5 | use embassy::time::{Duration, Timer}; |
| 6 | time::{Duration, Timer}, | ||
| 7 | }; | ||
| 8 | 6 | ||
| 9 | #[embassy::task] | 7 | #[embassy::task] |
| 10 | async fn ticker() { | 8 | async fn ticker() { |
| @@ -13,13 +11,9 @@ async fn ticker() { | |||
| 13 | let mut counter = 0; | 11 | let mut counter = 0; |
| 14 | loop { | 12 | loop { |
| 15 | let document = window.document().expect("should have a document on window"); | 13 | let document = window.document().expect("should have a document on window"); |
| 16 | let list = document | 14 | let list = document.get_element_by_id("log").expect("should have a log element"); |
| 17 | .get_element_by_id("log") | ||
| 18 | .expect("should have a log element"); | ||
| 19 | 15 | ||
| 20 | let li = document | 16 | let li = document.create_element("li").expect("error creating list item element"); |
| 21 | .create_element("li") | ||
| 22 | .expect("error creating list item element"); | ||
| 23 | li.set_text_content(Some(&format!("tick {}", counter))); | 17 | li.set_text_content(Some(&format!("tick {}", counter))); |
| 24 | 18 | ||
| 25 | list.append_child(&li).expect("error appending list item"); | 19 | list.append_child(&li).expect("error appending list item"); |
