aboutsummaryrefslogtreecommitdiff
path: root/core/sys/wasm
diff options
context:
space:
mode:
authorKarl Zylinski <karl@zylinski.se>2025-12-29 20:57:25 +0100
committerKarl Zylinski <karl@zylinski.se>2025-12-29 20:57:25 +0100
commit47f20c0ffb1d9e48e437c92e3312b4a14d3b8443 (patch)
tree9d9ebbb9a32fbd6d9567f213024955784baae366 /core/sys/wasm
parentfb52238e369dc5c1712d2eca2c787473af59bca3 (diff)
Added 'set_document_title' to be able to rename the tab
Diffstat (limited to 'core/sys/wasm')
-rw-r--r--core/sys/wasm/js/dom.odin2
-rw-r--r--core/sys/wasm/js/odin.js5
2 files changed, 7 insertions, 0 deletions
diff --git a/core/sys/wasm/js/dom.odin b/core/sys/wasm/js/dom.odin
index a4f8d7687..6dd9dbf45 100644
--- a/core/sys/wasm/js/dom.odin
+++ b/core/sys/wasm/js/dom.odin
@@ -22,6 +22,8 @@ foreign dom_lib {
window_set_scroll :: proc(x, y: f64) ---
set_element_style :: proc(id: string, key: string, value: string) ---
+
+ set_document_title :: proc(title: string) ---
}
get_element_value_string :: proc "contextless" (id: string, buf: []byte) -> string {
diff --git a/core/sys/wasm/js/odin.js b/core/sys/wasm/js/odin.js
index 063fd990c..19ac3093e 100644
--- a/core/sys/wasm/js/odin.js
+++ b/core/sys/wasm/js/odin.js
@@ -2050,6 +2050,11 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement, memory) {
}
},
+ set_document_title: (title_ptr, title_len) => {
+ let title = wasmMemoryInterface.loadString(title_ptr, title_len);
+ document.title = title;
+ },
+
get_element_key_f64: (id_ptr, id_len, key_ptr, key_len) => {
let id = wasmMemoryInterface.loadString(id_ptr, id_len);
let key = wasmMemoryInterface.loadString(key_ptr, key_len);