From 0a2f6f8cc48258fca60df2f193790b2d94a9d0f6 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Thu, 8 Oct 2026 06:22:41 +0200 Subject: wasm add resources tracking --- src/app/components/hello/root.zig | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/app/components/hello/root.zig') diff --git a/src/app/components/hello/root.zig b/src/app/components/hello/root.zig index 6f68550..55bf2e6 100644 --- a/src/app/components/hello/root.zig +++ b/src/app/components/hello/root.zig @@ -1,6 +1,8 @@ const std = @import("std"); const z = @import("z"); +const Self = @This(); + pub const component: z.Component = .{ .name = "hello", .html = .native( @@ -12,6 +14,15 @@ pub const component: z.Component = .{ .link = @This(), }; -pub fn clicked() void { - z.log.js.debug("hi"); +element: *z.Object, +counter: usize, + +pub fn init(self: *Self, element: *z.Object) void { + self.element = element; + self.counter = 0; +} + +pub fn clicked(self: *Self) void { + self.counter += 1; + std.log.info("clicked {} times", .{self.counter}); } -- cgit v1.2.3-70-g09d2