aboutsummaryrefslogtreecommitdiff
path: root/src/app/components/navbutton/root.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/components/navbutton/root.zig')
-rw-r--r--src/app/components/navbutton/root.zig15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/app/components/navbutton/root.zig b/src/app/components/navbutton/root.zig
index f2b71e6..6a403cb 100644
--- a/src/app/components/navbutton/root.zig
+++ b/src/app/components/navbutton/root.zig
@@ -1,6 +1,7 @@
const std = @import("std");
const app = @import("root").app;
const zilch = @import("zilch");
+const object = zilch.Object.bindings;
const Self = @This();
@@ -22,10 +23,16 @@ pub fn init(self: *Self, element: *zilch.Object) !void {
defer env.deinit();
self.element = element;
- self.shadow_root = try self.element.get(&env, "shadowRoot").await(&env, .object);
- const button = try self.shadow_root.call(&env, "getElementById", .{"button"}).await(&env, .object);
- defer _ = button.free(&env);
- self.button.classList = try button.get(&env, "classList").await(&env, .object);
+
+ var shadow_root = self.element.get(&env, "shadowRoot");
+
+ var button = env.call(object.call, .{shadow_root, "getElementById", "button"});
+
+ var class_list = env.call(object.get, .{button, "classList"});
+ self.button.classList = try class_list.await(&env, .object);
+
+ self.shadow_root = try shadow_root.await(&env, .object);
+ _ = (try button.await(&env, .object)).free(&env);
}
pub fn deinit(self: *Self) !void {