let JS handle the DOM; rearrange code

This commit is contained in:
2020-07-19 22:36:36 +01:00
parent ffd8a15eda
commit 3cdf52b5e2
2 changed files with 40 additions and 47 deletions

View File

@@ -7,11 +7,8 @@ use wasm_bindgen::prelude::*;
const SD: u32 = 8;
#[wasm_bindgen]
pub fn load_default_game_data() {
let window = web_sys::window().expect("no global `window` exists");
let document = window.document().expect("should have a document on window");
let game_data_input = document.get_element_by_id("game-data").expect("no game data input");
game_data_input.set_inner_html(&bitsy_parser::mock::game_default().to_string());
pub fn load_default_game_data() -> String {
bitsy_parser::mock::game_default().to_string()
}
fn tile_name(prefix: &str, index: &u32) -> Option<String> {