mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
sys/wasm/js: add set_element_style
This commit is contained in:
@@ -20,6 +20,8 @@ foreign dom_lib {
|
|||||||
device_pixel_ratio :: proc() -> f64 ---
|
device_pixel_ratio :: proc() -> f64 ---
|
||||||
|
|
||||||
window_set_scroll :: proc(x, y: f64) ---
|
window_set_scroll :: proc(x, y: f64) ---
|
||||||
|
|
||||||
|
set_element_style :: proc(id: string, key: string, value: string) ---
|
||||||
}
|
}
|
||||||
|
|
||||||
get_element_value_string :: proc "contextless" (id: string, buf: []byte) -> string {
|
get_element_value_string :: proc "contextless" (id: string, buf: []byte) -> string {
|
||||||
|
|||||||
@@ -1802,6 +1802,16 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory, ev
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
set_element_style: (id_ptr, id_len, key_ptr, key_len, value_ptr, value_len) => {
|
||||||
|
let id = wasmMemoryInterface.loadString(id_ptr, id_len);
|
||||||
|
let key = wasmMemoryInterface.loadString(key_ptr, key_len);
|
||||||
|
let value = wasmMemoryInterface.loadString(value_ptr, value_len);
|
||||||
|
let element = getElement(id);
|
||||||
|
if (element) {
|
||||||
|
element.style[key] = value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
get_element_key_f64: (id_ptr, id_len, key_ptr, key_len) => {
|
get_element_key_f64: (id_ptr, id_len, key_ptr, key_len) => {
|
||||||
let id = wasmMemoryInterface.loadString(id_ptr, id_len);
|
let id = wasmMemoryInterface.loadString(id_ptr, id_len);
|
||||||
let key = wasmMemoryInterface.loadString(key_ptr, key_len);
|
let key = wasmMemoryInterface.loadString(key_ptr, key_len);
|
||||||
|
|||||||
Reference in New Issue
Block a user