|
|
@ -361,7 +361,7 @@ function UIManager:debounce(seconds, immediate, action)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
is_scheduled = false
|
|
|
|
is_scheduled = false
|
|
|
|
if not immediate then
|
|
|
|
if not immediate then
|
|
|
|
result = action(unpack(args))
|
|
|
|
result = action(unpack(args, 1, args.n))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if not is_scheduled then
|
|
|
|
if not is_scheduled then
|
|
|
|
-- This check is needed because action can recursively call debounced_action_wrapper
|
|
|
|
-- This check is needed because action can recursively call debounced_action_wrapper
|
|
|
@ -376,7 +376,7 @@ function UIManager:debounce(seconds, immediate, action)
|
|
|
|
self:scheduleIn(seconds, scheduled_action)
|
|
|
|
self:scheduleIn(seconds, scheduled_action)
|
|
|
|
is_scheduled = true
|
|
|
|
is_scheduled = true
|
|
|
|
if immediate then
|
|
|
|
if immediate then
|
|
|
|
result = action(unpack(args))
|
|
|
|
result = action(unpack(args, 1, args.n))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return result
|
|
|
|
return result
|
|
|
@ -987,7 +987,7 @@ function UIManager:_checkTasks()
|
|
|
|
-- NOTE: Said task's action might modify _task_queue.
|
|
|
|
-- NOTE: Said task's action might modify _task_queue.
|
|
|
|
-- To avoid race conditions and catch new upcoming tasks during this call,
|
|
|
|
-- To avoid race conditions and catch new upcoming tasks during this call,
|
|
|
|
-- we repeatedly check the head of the queue (c.f., #1758).
|
|
|
|
-- we repeatedly check the head of the queue (c.f., #1758).
|
|
|
|
task.action(unpack(task.args))
|
|
|
|
task.action(unpack(task.args, 1, task.args.n))
|
|
|
|
else
|
|
|
|
else
|
|
|
|
-- As the queue is sorted in descending order, it's safe to assume all items are currently future tasks.
|
|
|
|
-- As the queue is sorted in descending order, it's safe to assume all items are currently future tasks.
|
|
|
|
wait_until = task_time
|
|
|
|
wait_until = task_time
|
|
|
|