.TH "bud/bud_dom_host.h" 3 "bud" \" -*- nroff -*- .ad l .nh .SH NAME bud/bud_dom_host.h \- Generic Browser DOM host_ops adapter for bud_reconcile (WASM & native)\&. .SH SYNOPSIS .br .PP \fR#include 'bud_reconcile\&.h'\fP .br \fR#include \fP .br .SS "Macros" .in +1c .ti -1c .RI "#define \fBBUD_DOM_ROOT_HANDLE\fP ((void *)(uintptr_t)1u)" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "\fBbud_host_ops\fP \fBbud_dom_host_ops\fP (void)" .br .RI "Return a \fBbud_host_ops\fP vtable backed by browser DOM host imports\&. " .ti -1c .RI "int \fBbud_dom_dispatch\fP (uint32_t handler_id, const char *payload, size_t payload_len)" .br .RI "Dispatch a DOM event from JS into a registered C \fBbud_event_handler_fn\fP\&. " .ti -1c .RI "const char * \fBbud_dom_event_payload\fP (void)" .br .RI "Return the current DOM event payload string during a bud_dom_dispatch call\&. " .ti -1c .RI "const char * \fBbud_dom_set_event_payload\fP (const char *payload)" .br .RI "Set the active event payload string for the current dispatch frame\&. " .ti -1c .RI "void \fBbud_dom_host_reset\fP (void)" .br .RI "Reset the internal event-listener registry (e\&.g\&. on unmount/test reset)\&. " .in -1c .SH "Detailed Description" .PP Generic Browser DOM host_ops adapter for bud_reconcile (WASM & native)\&. Bridges \fBbud_reconcile\&.h\fP directly onto browser DOM nodes via opaque integer handles (handle 1 = root container) and thin WASM host imports in bud-cap\&.js\&. .SH "Macro Definition Documentation" .PP .SS "#define BUD_DOM_ROOT_HANDLE ((void *)(uintptr_t)1u)" Root container handle reserved by the DOM host (handle 1)\&. .SH "Function Documentation" .PP .SS "int bud_dom_dispatch (uint32_t handler_id, const char * payload, size_t payload_len)" .PP Dispatch a DOM event from JS into a registered C \fBbud_event_handler_fn\fP\&. .PP \fBParameters\fP .RS 4 \fIhandler_id\fP Integer listener handle returned to JS by set_event\&. .br \fIpayload\fP Optional UTF-8 event payload (e\&.g\&. input value / key), passed to handler via ev\&.user if listener ud is NULL, or retrieved via \fBbud_dom_event_payload()\fP\&. .br \fIpayload_len\fP Byte length of payload\&. .RE .PP \fBReturns\fP .RS 4 Return value of the C handler (non-zero if stopped), or 0 if invalid\&. .RE .PP .SS "const char * bud_dom_event_payload (void )" .PP Return the current DOM event payload string during a bud_dom_dispatch call\&. Allows lifted \&.cx closures (which already occupy ev->user with their capture struct) to also read the DOM event payload (input value, key name, etc\&.)\&. .SS "\fBbud_host_ops\fP bud_dom_host_ops (void )" .PP Return a \fBbud_host_ops\fP vtable backed by browser DOM host imports\&. On WASM (\fBwasm\fP), each callback invokes the corresponding \fRbud\fP module import (\fRbud_dom_create_el\fP, etc\&.)\&. On native builds, stubs are provided for link compatibility (or unit testing via bud_dom_dispatch)\&. .SS "const char * bud_dom_set_event_payload (const char * payload)" .PP Set the active event payload string for the current dispatch frame\&. .PP \fBReturns\fP .RS 4 Previous payload pointer (pass back to restore)\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for bud from the source code\&.