core/sys/wasm/js
wasm_js_interface
Types
9Delta_Mode
Delta_Mode :: enum u32 {
Pixel = 0,
Line = 1,
Page = 2,
}SourceEvent
Event :: struct {
kind: Event_Kind,
target_kind: Event_Target_Kind,
current_target_kind: Event_Target_Kind,
id: string,
timestamp: f64,
phase: Event_Phase,
options: Event_Options,
is_composing: bool,
is_trusted: bool,
data: struct #raw_union {
scroll: struct {
delta: [2]f64,
},
visibility_change: struct {
is_visible: bool,
},
wheel: struct {
delta: [3]f64,
delta_mode: Delta_Mode,
},
key: struct {
key: string,
code: string,
location: Key_Location,
ctrl: bool,
shift: bool,
alt: bool,
meta: bool,
repeat: bool,
_key_buf: [16]u8,
_code_buf: [16]u8,
},
mouse: struct {
screen: [2]i64,
client: [2]i64,
offset: [2]i64,
page: [2]i64,
movement: [2]i64,
ctrl: bool,
shift: bool,
alt: bool,
meta: bool,
button: i16,
buttons: _,
},
},
}SourceEvent_Kind
Event_Kind :: enum u32 {
Invalid = 0,
Load = 1,
Unload = 2,
Error = 3,
Resize = 4,
Visibility_Change = 5,
Fullscreen_Change = 6,
Fullscreen_Error = 7,
Click = 8,
Double_Click = 9,
Mouse_Move = 10,
Mouse_Over = 11,
Mouse_Out = 12,
Mouse_Up = 13,
Mouse_Down = 14,
Key_Up = 15,
Key_Down = 16,
Key_Press = 17,
Scroll = 18,
Wheel = 19,
Focus = 20,
Submit = 21,
Blur = 22,
Change = 23,
Select = 24,
Animation_Start = 25,
Animation_End = 26,
Animation_Iteration = 27,
Animation_Cancel = 28,
Copy = 29,
Cut = 30,
Paste = 31,
// Drag,
// Drag_Start,
// Drag_End,
// Drag_Enter,
// Drag_Leave,
// Drag_Over,
// Drop,
Pointer_Cancel = 32,
Pointer_Down = 33,
Pointer_Enter = 34,
Pointer_Leave = 35,
Pointer_Move = 36,
Pointer_Over = 37,
Pointer_Up = 38,
Got_Pointer_Capture = 39,
Lost_Pointer_Capture = 40,
Pointer_Lock_Change = 41,
Pointer_Lock_Error = 42,
Selection_Change = 43,
Selection_Start = 44,
Touch_Cancel = 45,
Touch_End = 46,
Touch_Move = 47,
Touch_Start = 48,
Transition_Start = 49,
Transition_End = 50,
Transition_Run = 51,
Transition_Cancel = 52,
Context_Menu = 53,
Custom = 54,
}SourceEvent_Option
Event_Option :: enum u8 {
Bubbles = 0,
Cancelable = 1,
Composed = 2,
}SourceEvent_Options
Event_Options :: bit_set[Event_Option; u8]SourceEvent_Phase
Event_Phase :: enum u8 {
None = 0,
Capturing_Phase = 1,
At_Target = 2,
Bubbling_Phase = 3,
}SourceEvent_Target_Kind
Event_Target_Kind :: enum u32 {
Element = 0,
Document = 1,
Window = 2,
}SourceKey_Location
Key_Location :: enum u8 {
Standard = 0,
Left = 1,
Right = 2,
Numpad = 3,
}SourceRect
Rect :: struct {
x: f64,
y: f64,
width: f64,
height: f64,
}SourceConstants
3Variables
1event_kind_string
event_kind_string :: [55]string = [Event_Kind]string{
.Invalid = "",
.Load = "load",
.Unload = "unload",
.Error = "error",
.Resize = "resize",
.Visibility_Change = "visibilitychange",
.Fullscreen_Change = "fullscreenchange",
.Fullscreen_Error = "fullscrSourceProcedures
16add_custom_event_listener
add_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture: untyped boolean = false) -> (bool)Sourceadd_document_event_listener
add_document_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture: untyped boolean = false) -> (bool)Sourceadd_event_listener
add_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture: untyped boolean = false) -> (bool)Sourceadd_window_event_listener
add_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture: untyped boolean = false) -> (bool)Sourceget_bounding_client_rect
get_bounding_client_rect :: proc(id: string) -> (rect: Rect)Sourceget_element_min_max
get_element_min_max :: proc(id: string) -> (min: f64, max: f64)Sourceget_element_value_string
get_element_value_string :: proc(id: string, buf: []u8) -> (string)Sourcepage_alloc
page_alloc :: proc(page_count: int) -> (data: []u8, err: runtime.Allocator_Error)Sourcepage_allocator
page_allocator :: proc() -> (runtime.Allocator)Sourceremove_custom_event_listener
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture: untyped boolean = false) -> (bool)Sourceremove_document_event_listener
remove_document_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture: untyped boolean = false) -> (bool)Sourceremove_event_listener
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture: untyped boolean = false) -> (bool)Sourceremove_event_listener_from_event
remove_event_listener_from_event :: proc(e: Event) -> (bool)Sourceremove_window_event_listener
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture: untyped boolean = false) -> (bool)Sourcewindow_get_rect
window_get_rect :: proc() -> (rect: Rect)Sourcewindow_get_scroll
window_get_scroll :: proc() -> (x: f64, y: f64)Source