1
0
mirror of https://github.com/kepler155c/opus synced 2025-11-24 02:54:56 +00:00

Event cleanup

This commit is contained in:
kepler155c@gmail.com
2019-02-24 06:58:26 -05:00
parent 8ae3b33374
commit 687fc05445
3 changed files with 18 additions and 46 deletions

View File

@@ -35,8 +35,12 @@ function UI.Notification:success(value, timeout)
end
function UI.Notification:cancel()
if self.timer then
Event.off(self.timer)
self.timer = nil
end
if self.canvas then
Event.cancelNamedTimer('notificationTimer')
self.enabled = false
self.canvas:removeLayer()
self.canvas = nil
@@ -60,7 +64,7 @@ function UI.Notification:display(value, timeout)
self:write(2, k, v)
end
Event.addNamedTimer('notificationTimer', timeout or 3, false, function()
self.timer = Event.onTimeout(timeout or 3, function()
self:cancel()
self:sync()
end)