new Looper()
A class requests callback function before the browser performs the next frame repaint.
- Since:
-
- 2.0.0
Example
var Looper = caph.require('util.Looper').getInstance(); var update = function() { console.debug('update call'); Looper.off(update); } Looper.on(update);
Methods
-
off(subscriber)
-
Removes given function from Looper in order to stop it before the next frame is drawn.
Parameters:
Name Type Description subscriber
function A callback function to remove from Looper.
- Since:
-
- 2.0.0
Example
var Looper = caph.require('util.Looper').getInstance(); var update = function() { console.debug('update call'); // Update function is called once. Looper.off(update); } Looper.on(update);
-
on(subscriber)
-
Calls given function when the next frame is drawn.
Parameters:
Name Type Description subscriber
function A callback function to call when the next frame is repainted.
- Since:
-
- 2.0.0
Example
var Looper = caph.require('util.Looper').getInstance(); var update = function() { console.debug('update call'); } Looper.on(update);