Skip to content

Instantly share code, notes, and snippets.

@florian
Created April 7, 2012 13:23
Show Gist options
  • Save florian/2328855 to your computer and use it in GitHub Desktop.
Save florian/2328855 to your computer and use it in GitHub Desktop.
A small script that makes it possible to chain the HTML5 canvas methods. Pretty much a smaller version of chainvas: http://leaverou.github.com/chainvas/
(function(){
var c = window.CanvasRenderingContext2D.prototype,
wrapFn = function (method) {
return function () {
var ret = method.apply(this, arguments);
return ret === undefined ? this : method;
};
};
for (var i in c) {
c[i] = wrapFn(c[i]);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment