在看别人的一个datepicker插件的源码的时候,看到它里面绑定事件大量的这种代码
_bindEvents : function () {
this.$el.on(this.opts.showEvent + '.adp', this._onShowEvent.bind(this));
this.$el.on('mouseup.adp', this._onMouseUpEl.bind(this));
this.$el.on('blur.adp', this._onBlur.bind(this));
this.$el.on('keyup.adp', this._onKeyUpGeneral.bind(this));
$(window).on('resize.adp', this._onResize.bind(this));
$('body').on('mouseup.adp', this._onMouseUpBody.bind(this));
},
第一次见过这种事件后面加上adp的写法,甚是不解。有了解的同学可以帮忙解释一下么。
jQuery中文文档 - on函数
看一下后边的“命名空间”