JSFiddle - React, Tailwind, and code Playground
by darcyclarke
HTML
<canvas></canvas>
JavaScript
(function(window,undefined){
var tree = function(context){
this._context = $.extend(true,{},context);
this.original = context;
this.init = {};
this.init.fillRect = function(){
console.log('Fill Rect');
obj.original.fillRect.apply(null,arguments);
};
return this;
};
window.tree = tree;
})(window);
var context = document.getElementsByTagName('canvas')[0].getContext('2d');
context = new tree(context);
context.original.fillStyle = "#bada55";
console.log(context);
context.init.fillRect(0,0,50,50);