File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,32 +60,9 @@ fn main {
6060 })
6161 })
6262
63- // Build host page
64- let app = doc .get_element_by_id ("app" ).unwrap ()
65-
66- let heading = doc .create_element ("h1" )
67- heading .set_text_content ("Web Components Counter" )
68-
69- let counter1 = doc .create_element ("my-counter" )
70- counter1 .set_attribute ("id" , "counter-1" )
71-
72- let counter2 = doc .create_element ("my-counter" )
73- counter2 .set_attribute ("id" , "counter-2" )
74-
75- let log = doc .create_element ("div" )
76- log
77- ..set_attribute ("id" , "event-log" )
78- .set_attribute (
79- "style" , "margin-top: 1em; padding: 0.5em; border: 1px solid #ddd; border-radius: 4px; font-family: monospace; min-height: 2em;" ,
80- )
81- log .set_text_content ("Event log:" )
82-
83- app .append_child (heading ) |> ignore
84- app .append_child (counter1 ) |> ignore
85- app .append_child (counter2 ) |> ignore
86- app .append_child (log ) |> ignore
87-
8863 // Listen for count-changed events (bubbles up through composed boundary)
64+ let app = doc .get_element_by_id ("app" ).unwrap ()
65+ let log = doc .get_element_by_id ("event-log" ).unwrap ()
8966 app .add_event_listener ("count-changed" , fn (event ) {
9067 let ce : @webapi .CustomEvent = event .into ()
9168 let detail = ce .detail ()
Original file line number Diff line number Diff line change 77 < title > WC Counter Example</ title >
88</ head >
99< body >
10- < div id ="app "> </ div >
10+ < div id ="app ">
11+ < h1 > Web Components Counter</ h1 >
12+ < my-counter id ="counter-1 "> </ my-counter >
13+ < my-counter id ="counter-2 "> </ my-counter >
14+ < div id ="event-log " style ="margin-top: 1em; padding: 0.5em; border: 1px solid #ddd; border-radius: 4px; font-family: monospace; min-height: 2em; "> Event log:</ div >
15+ </ div >
1116 < script type ="module " src ="../_build/js/release/build/wc-counter/wc-counter.js "> </ script >
1217</ body >
1318</ html >
Original file line number Diff line number Diff line change 77 < title > WC Counter Example (wasm-gc)</ title >
88</ head >
99< body >
10- < div id ="app "> </ div >
10+ < div id ="app ">
11+ < h1 > Web Components Counter</ h1 >
12+ < my-counter id ="counter-1 "> </ my-counter >
13+ < my-counter id ="counter-2 "> </ my-counter >
14+ < div id ="event-log " style ="margin-top: 1em; padding: 0.5em; border: 1px solid #ddd; border-radius: 4px; font-family: monospace; min-height: 2em; "> Event log:</ div >
15+ </ div >
1116 < script type ="module ">
1217 import { wasmImportObject } from "../../src/webapi.mjs" ;
1318 const { instance } = await WebAssembly . instantiateStreaming (
You can’t perform that action at this time.
0 commit comments