【文件属性】:
文件名称:simpler-extend:用于继承和子类化的简单“扩展”助手
文件大小:11KB
文件格式:ZIP
更新时间:2021-06-11 23:18:12
JavaScript
简单扩展
用于继承和子类化的简单“扩展”助手。 改编自 Backbone.js 的和 CoffeeScript。 这与类似,只是它没有任何依赖项。
用法
将其分配给您的基类的.extend :
function Shape ( ) { ... }
Shape . extend = require ( 'simpler-extend' ) ;
然后使用它来子类化:
var Circle = Shape . extend ( {
getArea : function ( ) {
return this . width * this . height ;
}
} ) ;
您还可以添加一个构造函数作为constructor :
var Circle = Shape . extend ( {
constructor : function ( ) { ... }
}
【文件预览】:
simpler-extend-master
----man()
--------simpler-extend.1(3KB)
--------simpler-extend.1.md(2KB)
--------simpler-extend.1.html(7KB)
----.gitignore(13B)
----README.md(3KB)
----test()
--------scratch_test.js(246B)
--------mocha.opts(28B)
--------setup.js(78B)
--------test.js(1KB)
----HISTORY.md(213B)
----LICENSE(1KB)
----package.json(916B)
----index.js(1KB)
----.travis.yml(38B)