You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varAnimal=AClass(function(name){this.name=name;}).methods({talk: function(){return'I am '+this.name;}});varBird=Animal.extend(function(name){Animal.call(this,name);}).methods({fly: function(){return'I am flying';}});
2.0的确精简了很多,也较为易读了。
更新了原有的jsPerf,加了2.0的性能测试,同时添加了我自己的AClass。
http://jsperf.com/class-perfs/11
chrome有时刷不出来图,FF可以,真奇特。
arale的API都知道,不多说,说说我的:
比较而言:
暂时这些想法,贴下我的源码,可以精简掉static:
提供之前的思路吧,或许对师兄姐们有所帮助~
最后,期待下ES6的class,然后希望能寻找到一种安全等价无需额外附加的转换方法~目前我想到的要加个superClass才行(因为有super方法)。
The text was updated successfully, but these errors were encountered: