Skip to content

Commit c5108b0

Browse files
committed
fix(examples): correct spacing and update webui dependency
- update webui dependency hash and URL in build.zig.zon - fix spacing and argument formatting in main.zig example - improve code consistency for function bindings
1 parent a927d61 commit c5108b0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

build.zig.zon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
.{
1+
.{
22
.name = .zig_webui,
33
.version = "2.5.0-beta.4",
44
.fingerprint = 0x95965ed3cdfb8c33,
55
.minimum_zig_version = "0.14.0",
66
.dependencies = .{
77
.webui = .{
8-
.hash = "webui-2.5.0-beta.4-pxqD5fQfNwA7NvX6JvMRp54QofTDsyjmnynJiMRIlZw4",
9-
.url = "https://github.com/webui-dev/webui/archive/20bfc371b88285eadf4e3d7aa32c2d6b34e66691.tar.gz",
8+
.hash = "webui-2.5.0-beta.4-pxqD5bE4NwCVDCBguzzRmyOubiadAaVRNM0XMxqUv_GS",
9+
.url = "https://github.com/webui-dev/webui/archive/e673cee5a26b4c475395ce8e2f5fb92608bf3574.tar.gz",
1010
},
1111
},
1212
.paths = .{

examples/call_zig_from_js/main.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ pub fn main() !void {
1616
_ = try nwin.binding("my_function_string", getString);
1717
// Equivalent using traditional bind function which requires manual Event handling
1818
// _ = try nwin.bind("my_function_string", my_function_string);
19-
19+
2020
// Bind integer handler function, binding automatically converts JS parameters to corresponding Zig types
2121
_ = try nwin.binding("my_function_integer", getInteger);
2222
// _ = try nwin.bind("my_function_integer", my_function_integer);
23-
23+
2424
// Bind boolean handler function, also with automatic type conversion
2525
_ = try nwin.binding("my_function_boolean", getBool);
2626
// _ = try nwin.bind("my_function_boolean", my_function_boolean);
27-
27+
2828
// Bind function with response, binding supports using event object directly for responses
2929
_ = try nwin.binding("my_function_with_response", getResponse);
3030
// _ = try nwin.bind("my_function_with_response", my_function_with_response);
31-
31+
3232
// Bind function for handling binary data, binding supports raw binary data processing
3333
_ = try nwin.binding("my_function_raw_binary", raw_binary);
3434
// _ = try nwin.bind("my_function_raw_binary", my_function_raw_binary);
@@ -115,7 +115,7 @@ fn my_function_boolean(e: *webui.Event) void {
115115
std.debug.print("my_function_bool 2: {}\n", .{status_2});
116116
}
117117

118-
fn getResponse(e: *webui.Event,n1: i64, n2: i64) void {
118+
fn getResponse(e: *webui.Event, n1: i64, n2: i64) void {
119119
const res = n1 * n2;
120120
std.debug.print("my_function_with_response: {} * {} = {}\n", .{ n1, n2, res });
121121
// Send back the response to JavaScript

0 commit comments

Comments
 (0)