Made most libraries panic on js targets instead of not compiling

This commit is contained in:
Dragos Popescu
2023-03-20 04:08:48 +01:00
parent fe533fb809
commit adac039a2b
7 changed files with 569 additions and 2 deletions
+36
View File
@@ -0,0 +1,36 @@
//+build !js
package wasm_js_interface
import "core:runtime"
get_element_value_string :: proc "contextless" (id: string, buf: []byte) -> string {
context = runtime.default_context()
panic("vendor:wasm/js not supported on non JS targets")
}
get_element_min_max :: proc "contextless" (id: string) -> (min, max: f64) {
context = runtime.default_context()
panic("vendor:wasm/js not supported on non JS targets")
}
Rect :: struct {
x, y, width, height: f64,
}
get_bounding_client_rect :: proc "contextless" (id: string) -> (rect: Rect) {
context = runtime.default_context()
panic("vendor:wasm/js not supported on non JS targets")
}
window_get_rect :: proc "contextless" () -> (rect: Rect) {
context = runtime.default_context()
panic("vendor:wasm/js not supported on non JS targets")
}
window_get_scroll :: proc "contextless" () -> (x, y: f64) {
context = runtime.default_context()
panic("vendor:wasm/js not supported on non JS targets")
}