UNPKG

578 BJavaScriptView Raw
1"use strict";
2exports.__esModule = true;
3/**
4 * 封装事件,便于使用上下文this,和便于解除事件时使用
5 * @protected
6 * @param {Object} obj 对象
7 * @param {String} action 事件名称
8 * @return {Function} 返回事件处理函数
9 */
10function wrapBehavior(obj, action) {
11 if (obj['_wrap_' + action]) {
12 return obj['_wrap_' + action];
13 }
14 var method = function (e) {
15 obj[action](e);
16 };
17 obj['_wrap_' + action] = method;
18 return method;
19}
20exports["default"] = wrapBehavior;
21//# sourceMappingURL=wrap-behavior.js.map
\No newline at end of file