zoukankan      html  css  js  c++  java
  • 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});
  • 相关阅读:
    python--进程
    python---多线程
    python--上下文管理器
    python中的单例模式
    装饰器
    匿名函数
    python的内置方法
    命名元组
    如何管理我们的项目环境
    启动APP遇到“UiAutomator exited unexpectedly with code 0, signal null”解决
  • 原文地址:https://www.cnblogs.com/xsSystem/p/3103432.html
Copyright © 2011-2022 走看看