JSFiddle - React, Tailwind, and code Playground
by pajtai
JavaScript
var Engine = function(model) {
this.model = model;
};
Engine.prototype.start = function() {
console.log("ready");
this.requestAnimationFrame(function() {
console.log("done");
});
};
Engine.prototype.updateUi = function() {
console.log("update ui");
this.requestAnimationFrame(this.updateUi);
};
Engine.prototype.logRAF = function() {
console.log(window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame);
return this;
};
Engine.prototype.requestAnimationFrame = function(/* function */ callback, /* DOMElement */ element){
window.setTimeout(callback, 1000);
};
var engine = new Engine();
engine.logRAF().start();