refactor: improve capsulation and safety of tui module public api
This commit is contained in:
parent
4145460012
commit
1d947ab499
28 changed files with 239 additions and 198 deletions
|
|
@ -28,13 +28,13 @@ pub fn create(allocator: std.mem.Allocator, parent: Plane, event_handler: ?Event
|
|||
.on_event = event_handler,
|
||||
.tz = zeit.local(allocator, &env) catch |e| return tp.exit_error(e, @errorReturnTrace()),
|
||||
};
|
||||
try tui.current().message_filters.add(MessageFilter.bind(self, receive_tick));
|
||||
try tui.message_filters().add(MessageFilter.bind(self, receive_tick));
|
||||
self.update_tick_timer(.init);
|
||||
return Widget.to(self);
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Self, allocator: std.mem.Allocator) void {
|
||||
tui.current().message_filters.remove_ptr(self);
|
||||
tui.message_filters().remove_ptr(self);
|
||||
if (self.tick_timer) |*t| {
|
||||
t.cancel() catch {};
|
||||
t.deinit();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue