- Go backend (server/)
- Frontend (web/, server/static/)
- Database and deployment files
- Scripts and docs
Co-Authored-By: 狸花猫/Claude-Qwen3.6-Plus 🐾
21 lines
492 B
TypeScript
21 lines
492 B
TypeScript
|
||
/**
|
||
* 封装事件,便于使用上下文this,和便于解除事件时使用
|
||
* @protected
|
||
* @param {Object} obj 对象
|
||
* @param {String} action 事件名称
|
||
* @return {Function} 返回事件处理函数
|
||
*/
|
||
function wrapBehavior(obj: object, action: string): Function {
|
||
if (obj['_wrap_' + action]) {
|
||
return obj['_wrap_' + action];
|
||
}
|
||
const method = e => {
|
||
obj[action](e);
|
||
};
|
||
obj['_wrap_' + action] = method;
|
||
return method;
|
||
}
|
||
|
||
export default wrapBehavior;
|