aboutsummaryrefslogtreecommitdiff
path: root/src/app/components/hello/root.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-10-08 06:22:41 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-10-08 06:22:41 +0200
commit0a2f6f8cc48258fca60df2f193790b2d94a9d0f6 (patch)
treeebc38d94f1e4d9e5c2cb30a26db5d4ec6c9b38b5 /src/app/components/hello/root.zig
parent4e86e3e18e9b43e442a35361ac82b30dd6c0103a (diff)
wasm add resources tracking
Diffstat (limited to 'src/app/components/hello/root.zig')
-rw-r--r--src/app/components/hello/root.zig15
1 files changed, 13 insertions, 2 deletions
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});
}