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});
  • 相关阅读:
    js 性能调试
    js 面向对象编程
    js 零碎
    如果遇到二维数组 想取某个字段的和
    昨天写支付接口时遇到支付接口返回数据接收地址,session数据丢失(或者说失效)的问题
    mysql报错: 1548-Cannot load from mysql.proc. The table is probably corrupted 解决办法
    php 时间倒计时代码 个人写法 有好的想法的欢迎贴出来分享
    linux 环境下安装mysql5.6
    关于数据库连接不上 出现错误的问题
    推荐一个不错的css3网站 可以直接调用的
  • 原文地址:https://www.cnblogs.com/xsSystem/p/3103432.html
Copyright © 2011-2022 走看看