Skip to content

Commit f605542

Browse files
authored
feat: new api interfaceSetResponseFileHandler (#78)
* new api * little change
1 parent 3dc4819 commit f605542

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
.minimum_zig_version = "0.12.0",
55
.dependencies = .{
66
.webui = .{
7-
.url = "https://github.com/webui-dev/webui/archive/0ff3b1351b9e24be4463b1baf2c26966caeae74a.tar.gz",
8-
.hash = "12202382fb8300ffdb1e6f183d212a796b85321e8421162148137d04f2d470e8cf5b",
7+
.url = "https://github.com/webui-dev/webui/archive/ddc94db8db945c19775f46773497201adb859e28.tar.gz",
8+
.hash = "12205596edfd142c9fd9e0eae6b3fdc188a6d6f869f37ad47c5c853f73623e3ec87e",
99
},
1010
},
1111
.paths = .{

examples/text_editor/ui/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ <h1>WebUI Text Editor</h1>
3636
v1.1
3737
<p>Example of a text editor software in Zig using WebUI library.</p>
3838
<p>
39-
<a href="https://webui.me" target="_blank">webui.me</a> | (C)2024
39+
<a href="https://webui.me" target="_blank">webui.me</a> | (C)2025
4040
Hassan Draga
4141
</p>
4242
</div>

src/c.zig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,22 @@ pub extern fn webui_set_file_handler_window(
242242
) callconv(.C) ?*const anyopaque,
243243
) callconv(.C) void;
244244

245+
///
246+
/// @brief Use this API to set a file handler response if your backend need async
247+
/// response for `webui_set_file_handler()`.
248+
///
249+
/// @param window The window number
250+
/// @param response The response buffer
251+
/// @param length The response size
252+
///
253+
/// @example webui_interface_set_response_file_handler(myWindow, buffer, 1024);
254+
///
255+
pub extern fn webui_interface_set_response_file_handler(
256+
window: usize,
257+
response: ?*const anyopaque,
258+
length: usize,
259+
) callconv(.C) void;
260+
245261
/// @brief Check if the specified window is still running.
246262
///
247263
/// @param window The window number

src/webui.zig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ pub fn setFileHandlerWindow(self: webui, comptime handler: fn (window_handle: us
195195
c.webui_set_file_handler_window(self.window_handle, tmp_struct.handle);
196196
}
197197

198+
/// Use this API to set a file handler response if your backend need async
199+
/// response for `setFileHandler()`.
200+
pub fn interfaceSetResponseFileHandler(self: webui, response: []u8) void {
201+
c.webui_interface_set_response_file_handler(
202+
self.window_handle,
203+
@ptrCast(response.ptr),
204+
response.len,
205+
);
206+
}
207+
198208
/// Check if the specified window is still running.
199209
pub fn isShown(self: webui) bool {
200210
return c.webui_is_shown(self.window_handle);

0 commit comments

Comments
 (0)