【文件属性】:
文件名称:EventMixin.js:将事件行为添加到javascript对象
文件大小:2KB
文件格式:ZIP
更新时间:2021-05-15 04:31:23
JavaScript
EventMixin.js
将事件行为添加到javascript对象
用法
由于EventMixin是mixin ,因此必须将其用作mixin 。
使用jQuery的$.extend的示例,但是有很多替代方法:
// Create a class and we want to add event to this class
var Simpson = function ( name ) {
this . name = name ;
// create an event
this . createEvent ( 'updateName' ) ;
}
// * * * Here we add EventMixin to the prototype of the class Simpson
Simpson . prototype = $ . extend ( Simpson
【文件预览】:
EventMixin.js-master
----LICENSE(1KB)
----README.md(1KB)
----EventMixin.js(1KB)