@@ -8,8 +8,10 @@ const html = @embedFile("index.html");
88pub fn main () ! void {
99 var nwin = try webui .newWindow ();
1010
11- _ = try nwin .bind ("my_function_string" , my_function_string );
12- _ = try nwin .bind ("my_function_integer" , my_function_integer );
11+ _ = try nwin .binding ("my_function_string" , getString );
12+ // _ = try nwin.bind("my_function_string", my_function_string);
13+ _ = try nwin .binding ("my_function_integer" , getInteger );
14+ // _ = try nwin.bind("my_function_integer", my_function_integer);
1315 _ = try nwin .bind ("my_function_boolean" , my_function_boolean );
1416 _ = try nwin .bind ("my_function_with_response" , my_function_with_response );
1517 _ = try nwin .bind ("my_function_raw_binary" , my_function_raw_binary );
@@ -21,6 +23,13 @@ pub fn main() !void {
2123 webui .clean ();
2224}
2325
26+ fn getString (str1 : [:0 ]const u8 , str2 : [:0 ]const u8 ) void {
27+ // Hello
28+ std .debug .print ("my_function_string 1: {s}\n " , .{str1 });
29+ // World
30+ std .debug .print ("my_function_string 2: {s}\n " , .{str2 });
31+ }
32+
2433fn my_function_string (e : * webui.Event ) void {
2534 // JavaScript:
2635 // my_function_string('Hello', 'World`);
@@ -35,6 +44,12 @@ fn my_function_string(e: *webui.Event) void {
3544 std .debug .print ("my_function_string 2: {s}\n " , .{str_2 });
3645}
3746
47+ fn getInteger (n1 : i64 , n2 : i64 , n3 : i64 , f1 : f64 ) void {
48+ std .debug .print ("number is {},{},{},{}" , .{
49+ n1 , n2 , n3 , f1 ,
50+ });
51+ }
52+
3853fn my_function_integer (e : * webui.Event ) void {
3954 // JavaScript:
4055 // my_function_integer(123, 456, 789, 12345.6789);
@@ -95,7 +110,7 @@ fn my_function_raw_binary(e: *webui.Event) void {
95110
96111 // Or e.getStringAt(0);
97112 const raw_1 = e .getString ();
98- const raw_2 = e .getStringAt (1 );
113+ const raw_2 = e .getRawAt (1 );
99114
100115 // Or e.getSizeAt(0);
101116 const len_1 = e .getSize () catch return ;
0 commit comments