• addListener( String/Object eventName, [Function fn], [Object scope], [Object options] )


    An object containing handler configuration.

    Note: Unlike in ExtJS 3.x, the options object will also be passed as the last argument to every event handler.

    This object may contain any of the following properties:

    • scope : Object 

      The scope (this reference) in which the handler function is executed. If omitted, defaults to the object which fired the event.
      事件处理函数执行时所在的作用域。处理函数“this”的上下文环境.如果省略,缺省为其触发事件的对象。

    • delay : Number

      The number of milliseconds to delay the invocation of the handler after the event fires.
      延迟处理程序调用的事件触发后的毫秒数。

    • single : Boolean

      True to add a handler to handle just the next firing of the event, and then remove itself.
      为真的话呢就表示这个事件处理器只执行一次,之后自删除。

    • buffer : Number

      Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.
      这个值表示,在事件发生后,事件处理函数将放到Ext.util.DelayedTask中去计划执行,多少毫秒之内,如果再次发生同一事件,那么,这一事件将覆盖原来的事件。只执行后面那一次,当然,那个缓冲时间也在后一次时被刷新。

    • target : Ext.util.Observable

      Only call the handler if the event was fired on the target Observable, not if the event was bubbled up from a child Observable.
      如果指定target(dom)那么在事件冒泡过程中,当遇到指定dom元素,才执行事件处理函数;// target: el.up('div')遇到里头的第一个'div'才会触发事件

    • element : String

      This option is only valid for listeners bound to Components. The name of a Component property which references an element to add a listener to.

      This option is useful during Component construction to add DOM event listeners to elements of Components which will exist only after the Component is rendered. For example, to add a click listener to a Panel's body:

      网上没找到翻译:我的翻译不一定准确:事件冒泡有效区域,到冒泡至element则终止

      newExt.panel.Panel({
            title:'The title',
            listeners:{
                click:this.handlePanelClick,
                element:'body'}});

      Combining Options //组合设置的例子

      Using the options argument, it is possible to combine different types of listeners:

      A delayed, one-time listener.

      myPanel.on('hide',this.handleClick,this,{
          single:true,
          delay:100});
  • 相关阅读:
    springmvc学习笔记---idea创建springmvc项目
    Spring Boot中使用Swagger2构建RESTful API文档
    Dubbo原理实现之使用Javassist字节码结束构建代理对象
    Dubbo启动时服务检查
    Dubbo原理实现之代理接口的定义
    dubbo实现原理之动态编译
    Dubbo实现原理之基于SPI思想实现Dubbo内核
    dubbo实现原理之SPI简介
    Spring中使用StandardServletMultipartResolver进行文件上传
    SpringCloud之Feign
  • 原文地址:https://www.cnblogs.com/xsSystem/p/3103432.html
Copyright © 2020-2023  润新知