"set palette" function

This commit is contained in:
Max Bradbury 2020-11-04 16:18:38 +00:00
parent 4c958373ba
commit ca93a00eda
1 changed files with 10 additions and 0 deletions

View File

@ -94,6 +94,16 @@ pub fn set_room_name(room_name: String) {
} }
} }
#[wasm_bindgen]
pub fn set_palette(palette_id: String) {
let mut state = STATE.lock().unwrap();
match palette_id.is_empty() {
true => { state.palette = None },
false => { state.palette = Some(palette_id) },
}
}
#[wasm_bindgen] #[wasm_bindgen]
pub fn add_room() -> String { pub fn add_room() -> String {
let mut state = STATE.lock().expect("Couldn't lock application state"); let mut state = STATE.lock().expect("Couldn't lock application state");