new Rafael
Rafael.tasks
maintains a record of all currently running tasks
associated with this instance of Rafael.
This will kick off the Rafael
's loop to constantly run tasks.
Rafael.schedule(taskId, task, options)
Schedule a task to be run in our loop. It takes up to three arguments:
taskId
, task
, and options
.
taskId
(optional) represents the ID you'll use to interact with this task
later on. If an ID isn't set then it will be the index of the new task in
this.tasks
.
task
(required) is the function to be run on this Rafael
.
options
(optional) is a hash of options thingies?
context
(optional) is the value of this
within the function. If not
set, the context will be window
.
paused
(optional) determines whether this task will run immediately
after being added to the schedule
framerate
(optional) is the speed at which the task should be run in
frames per second (fps)
Rafael.unschedule(id)
Remove a task from our loop. id
is ID of the task to be removed from this Rafael
.
Rafael.clear()
Remove all tasks from the Rafael
. We just overwrite the original array
since this is a destructive operation.
Rafael.pause(id)
TODO: Describe
Rafael.start(id)
TODO: Describe
Rafael._taskCaller(taskObject)
Start the loop requestAnimationFrame
loop for this Rafael
.
Rafael._startLoop()
Start the loop requestAnimationFrame
loop for this Rafael
.
Rafael._shouldRun()
Compares the passed in framerate against the current frame to determine if the task should run on this frame
Rafael v3.0.0