diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-08 20:05:11 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-08 20:05:55 +0200 |
| commit | 008f090e1de2773d501a8210bd54acc7d977ebf7 (patch) | |
| tree | f62ab34861970425d1e4666b3f81cc17d84d1e4f /src/app/components/hello/root.zig | |
| parent | 7e22857bc903f24823ae8c02affdd879714c3a26 (diff) | |
Component: add namespace option
Diffstat (limited to 'src/app/components/hello/root.zig')
| -rw-r--r-- | src/app/components/hello/root.zig | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/app/components/hello/root.zig b/src/app/components/hello/root.zig deleted file mode 100644 index 6dafd98..0000000 --- a/src/app/components/hello/root.zig +++ /dev/null @@ -1,35 +0,0 @@ -const std = @import("std"); -const z = @import("z"); - -const Self = @This(); - -pub const component: z.Component = .{ - .name = "hello", - .html = .parse(@embedFile("index.html")), - .css = @embedFile("index.css"), - .link = @This(), -}; - -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, event: *z.Object) !void { - var env: z.Env = .init(std.heap.wasm_allocator); - defer env.deinit(); - - self.counter += 1; - - const x = event.get(&env, "x"); - const y = event.get(&env, "y"); - - std.log.info("clicked {} times at ({}, {})", .{ - self.counter, - try x.await(&env, .uint), - try y.await(&env, .uint), - }); -} |