Skip to content

Commit 6ebe20f

Browse files
committed
feat(webui): add logger, hwnd, and close handler APIs
- add `setLogger()` for custom logging callback support - add `getHwnd()` to retrieve window handle (Win32/Linux) - add `setCloseHandlerWv()` to handle WebView close events - add `LoggerLevel` enum with Debug, Info, and Error levels - update webui dependency to latest commit - clean up code formatting and whitespace across examples
1 parent c91c063 commit 6ebe20f

File tree

9 files changed

+249
-179
lines changed

9 files changed

+249
-179
lines changed

build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
.minimum_zig_version = "0.14.0",
66
.dependencies = .{
77
.webui = .{
8-
.hash = "webui-2.5.0-beta.4-pxqD5ahSNwAE_vnS170oThHZ3blPcHQ85Ut2XHf65f1u",
9-
.url = "https://github.com/webui-dev/webui/archive/dcc776a0f6bdf244d0024042253ebd194271ac9b.tar.gz",
8+
.hash = "webui-2.5.0-beta.4-pxqD5YHONwCkBgMnrKMXMcTvObSyZEBPPJq-gdULMwIj",
9+
.url = "https://github.com/webui-dev/webui/archive/e1018c5d8c251fad9fa8fc2f9d2d50af06bd2fed.tar.gz",
1010
},
1111
},
1212
.paths = .{

examples/advanced_window/main.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn main() !void {
2525
webui.setTimeout(30); // 30 seconds timeout
2626

2727
// Set window icon (raw SVG string)
28-
const icon_svg =
28+
const icon_svg =
2929
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\">" ++
3030
"<circle cx=\"8\" cy=\"8\" r=\"8\" fill=\"#4285F4\"/></svg>";
3131
window.setIcon(icon_svg, "image/svg+xml");

examples/compat.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ pub fn fixedBufferStream(buffer: []u8) FixedBufferStream {
4444
}
4545

4646
/// Type alias for FixedBufferStream that works in both versions
47-
pub const FixedBufferStream = if (is_zig_0_16_or_later) blk: {
47+
pub const FixedBufferStream = if (is_zig_0_16_or_later)
48+
blk: {
4849
// Zig 0.16: Define our own FixedBufferStream with custom Writer
4950
break :blk struct {
5051
buffer: []u8,
5152
pos: usize = 0,
5253

5354
const Self = @This();
54-
55+
5556
// Custom Writer implementation for Zig 0.16
5657
pub const Writer = struct {
5758
context: *Self,

examples/comprehensive/main.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ fn getSystemInfo(e: *webui.Event) void {
283283
const builtin = @import("builtin");
284284

285285
var buffer: [1024]u8 = undefined;
286-
const info = std.fmt.bufPrintZ(buffer[0..],
286+
const info = std.fmt.bufPrintZ(buffer[0..],
287287
\\{{"os":"{s}","arch":"{s}","zigVersion":"{s}","webuiVersion":"2.5.0","timestamp":{}}}
288288
, .{ @tagName(builtin.os.tag), @tagName(builtin.cpu.arch), @import("builtin").zig_version_string, compat.timestamp() }) catch "{}";
289289

0 commit comments

Comments
 (0)