Plato on Github
Report Home
src/core/nexttick.js
Maintainability
150.44
Lines of code
10
Difficulty
7.20
Estimated Errors
0.04
Function weight
By Complexity
By SLOC
/** * Trying to find a better alternative than setTimeout(fn, 0) * requestAnimationFrame should be a better alternative */ define('nexttick', ['requestanimationframe', 'cancelanimationframe'], function(requestAnimationFrame, cancelAnimationFrame) { return function(fn) { var id = requestAnimationFrame(function() { if (fn != null) { fn(); } cancelAnimationFrame(id); }); }; });