mirror of
https://github.com/kepler155c/opus
synced 2025-10-15 07:47:40 +00:00
Event cleanup
This commit is contained in:
@@ -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)
|
||||
|
@@ -62,10 +62,9 @@ function UI.StatusBar:getValue(name)
|
||||
end
|
||||
|
||||
function UI.StatusBar:timedStatus(status, timeout)
|
||||
timeout = timeout or 3
|
||||
self:write(2, 1, Util.widthify(status, self.width-2), self.backgroundColor)
|
||||
Event.addNamedTimer('statusTimer', timeout, false, function()
|
||||
if self.parent.enabled then
|
||||
Event.on(timeout or 3, function()
|
||||
if self.enabled then
|
||||
self:draw()
|
||||
self:sync()
|
||||
end
|
||||
|
Reference in New Issue
Block a user