Skip to content

Commit f9fdbf6

Browse files
committed
chore: add more comment for binding
1 parent a5c63bc commit f9fdbf6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/webui.zig

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ pub fn interfaceScriptClient(self: webui, event_number: usize, script_content: [
732732
if (!success) return WebUIError.ScriptError;
733733
}
734734

735+
/// binding function: Creates a binding between an HTML element and a callback function
735736
/// binding function: Creates a binding between an HTML element and a callback function
736737
/// - element: A null-terminated string identifying the HTML element(s) to bind to
737738
/// - callback: A function to be called when the bound event triggers
@@ -745,11 +746,15 @@ pub fn interfaceScriptClient(self: webui, event_number: usize, script_content: [
745746
/// The callback function can accept various parameter types:
746747
/// - Event: Gets the full event object
747748
/// - *Event: Gets a pointer to the event object
748-
/// - bool: Converted from event data
749-
/// - int types: Converted from event data
750-
/// - float types: Converted from event data
751-
/// - [:0]const u8: For null-terminated string data
752-
/// - [*]const u8: For raw pointer data
749+
/// - Other parameters will be automatically converted from event arguments in order:
750+
/// * bool: Converted from event argument bool value
751+
/// * int types: Converted from event argument integer value
752+
/// * float types: Converted from event argument float value
753+
/// * [:0]const u8: For null-terminated string data from event
754+
/// * [*]const u8: For raw pointer data from event
755+
///
756+
/// Note: Event and *Event parameters do not consume argument indices from the event,
757+
/// but all other parameter types will consume arguments in the order they appear.
753758
///
754759
/// Returns:
755760
/// - The binding ID that can be used to unbind later

0 commit comments

Comments
 (0)