event
Description
在HTML元素上设置事件处理器
event: (node: HTMLElement | string, event: string, handler: SchedulerCallback, master?: any) => string
Parameters
node- (required) HTMLElement | string - HTML元素或其idevent- (required) string - HTML事件的名称(不带'on'前缀)handler- (required) function - 处理事件的函数master- (optional) object - handler内部this所指向的对象
Returns
id- (string) - 事件处理器的id(可用于eventRemove()方法)
Example
// 为'click'事件附加处理器
scheduler.event("divId", "click", function(e){
//e - 原生event对象
do_something();
});
Details
通过event添加的所有事件监听器将在调用destructor时自动移除。
Related API
Change log
- 版本4.4新增
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.