2012-02-07 01:41:53 +01:00
|
|
|
function scheduleEvent(callback, delay)
|
2012-02-06 20:19:47 +01:00
|
|
|
local event = g_dispatcher.scheduleEvent(callback, delay)
|
|
|
|
|
|
|
|
-- must hold a reference to the callback, otherwise it would be collected
|
|
|
|
event._callback = callback
|
|
|
|
return event
|
2011-11-07 01:14:51 +01:00
|
|
|
end
|
|
|
|
|
2012-02-06 20:19:47 +01:00
|
|
|
function addEvent(callback, front)
|
|
|
|
local event = g_dispatcher.addEvent(callback, front)
|
|
|
|
-- must hold a reference to the callback, otherwise it would be collected
|
|
|
|
event._callback = callback
|
|
|
|
return event
|
2011-12-07 01:31:55 +01:00
|
|
|
end
|
|
|
|
|
2012-02-06 20:19:47 +01:00
|
|
|
function removeEvent(event)
|
|
|
|
if event then
|
|
|
|
event:cancel()
|
2011-11-07 01:14:51 +01:00
|
|
|
end
|
2011-08-14 19:45:25 +02:00
|
|
|
end
|