Invoke callback
in wait
, unless the job is re-registered,
which resets the timer. If wait
is not supplied, this will use
window.requestAnimationFrame
instead of a Timer
.
For example:
_myJob = Polymer.scheduleJob(_myJob, callback);
Returns the newly created job.
// Dart note: renamed to scheduleJob to be a bit more consistent with Dart.
PolymerJob scheduleJob(PolymerJob job, void callback(), [Duration wait]) {
if (job == null) job = new PolymerJob._();
// Dart note: made start smarter, so we don't need to call stop.
return job..start(callback, wait);
}