A.Timer Class
alloy-ui/src/aui-timer/js/aui-timer.js:14
A base class for Timer.
Constructor
A.Timer
()
Index
Methods
_create
-
repeats
-
ms
-
fn
Creates a collection of timer definitions.
Parameters:
-
repeats
Object -
ms
Object -
fn
Object
Returns:
_decrementNextRunTime
-
tasks
Subtracts the current time with the last run time. The result of this operation is subtracted with the task timeout.
Parameters:
-
tasks
Object
_getNearestInterval
-
num
Calculates the nearest interval by using the modulus of the argument with the interval as reference.
Parameters:
-
num
Object
Returns:
_lazyDestroy
()
protected
Checks if the timer is initialized and empty, then calls the
clearTimeout
function using the global interval id.
_lazyInit
()
protected
Checks if the timer is initialized and contains a task, then calls the
setTimeout
function and stores the global interval id.
_loop
-
i
-
pendingTasks
-
length
Goes through all pending tasks and initializes its timer or unregisters it depending on the task status.
Parameters:
-
i
Object -
pendingTasks
Object -
length
Object
_resetNextRunTime
-
task
Resets the next run time.
Parameters:
-
task
Object
_runner
()
protected
Gets the arguments to call the _loop
method.
A.clearInterval
-
id
Cancels repeated action which was set up using setInterval
function.
Parameters:
-
id
Object
A.clearTimeout
-
id
Clears the delay set by setTimeout
function.
Parameters:
-
id
Object
A.setInterval
-
fn
-
ms
-
context
Calls a function repeatedly, with a fixed time delay between each call to that function.
Parameters:
-
fn
Object -
ms
Object -
context
Object
A.setTimeout
-
fn
-
ms
-
context
Calls a function after a specified delay.
Parameters:
-
fn
Object -
ms
Object -
context
Object
clearInterval
-
id
Cancels repeated action which was set up using setInterval
function.
Parameters:
-
id
Object
clearTimeout
-
id
Clears the delay set by setTimeout
function.
Parameters:
-
id
Object
intervalTime
-
newInterval
Defines the fixed time delay between each interval.
Parameters:
-
newInterval
Object
Returns:
isRepeatable
-
task
Checks if the task is repeatable or not.
Parameters:
-
task
Object
Returns:
register
-
repeats
-
fn
-
ms
-
context
-
args
Adds a new task to the timer.
Parameters:
-
repeats
Object -
fn
Object -
ms
Object -
context
Object -
args
Object
run
-
task
Runs the task function.
Parameters:
-
task
Object
setInterval
-
fn
-
ms
-
context
Calls a function repeatedly, with a fixed time delay between each call to that function.
Parameters:
-
fn
Object -
ms
Object -
context
Object
setTimeout
-
fn
-
ms
-
context
Calls a function after a specified delay.
Parameters:
-
fn
Object -
ms
Object -
context
Object
unregister
-
repeats
-
id
Removes a task from the timer.
Parameters:
-
repeats
Object -
id
Object