Skip to content

Instantly share code, notes, and snippets.

@boof
Created March 19, 2015 15:19
Show Gist options
  • Save boof/bbaf4242cdb85c42a843 to your computer and use it in GitHub Desktop.
Save boof/bbaf4242cdb85c42a843 to your computer and use it in GitHub Desktop.
Spot the mistake!
(function (fn) {
var callbacks = [];
fn.draw = function (op) {
var deferred = $.Deferred();
op = op.bind(this);
requestAnimationFrame(function () {
op();
callbacks.forEach(function (callback) { callback(); });
deferred.resolve();
});
return deferred;
}
fn.onDraw = function (callback) {
callback = callback.bind(this);
callbacks.push(callback);
};
})(View.prototype);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment