为什么HTML5 CANVAS对象 context对象 的prototype属性 不能通过这种方法拓展对象的方法var canvas=document.getElementById('test');
context = canvas.getContext('2d');
context.prototype.ttt=function(){
alert('s');
}上面代码运行出错Uncaught TypeError: Cannot set property 'ttt' of undefined prototypehtml5canvas
context = canvas.getContext('2d');
context.prototype.ttt=function(){
alert('s');
}上面代码运行出错Uncaught TypeError: Cannot set property 'ttt' of undefined prototypehtml5canvas
我找到答案了
http://stackoverflow.com/questions/7789636/modify-native-canvasrenderingcontext2d-functions