The Handler class is an event handler class. It is recommended to create a Handler object from the object pool using the Handler.create() method to reduce the overhead of object creation. When a Handler object is no longer needed, it can be recovered to the object pool using Handler.recover(). Do not use this object after recovery, as doing so may lead to unpredictable errors. Note: Since mouse events also use this object pool, improper recovery and invocation may affect the execution of mouse events.

Handler 是事件处理器类。 推荐使用 Handler.create() 方法从对象池创建,减少对象创建消耗。创建的 Handler 对象不再使用后,可以使用 Handler.recover() 将其回收到对象池,回收后不要再使用此对象,否则会导致不可预料的错误。 注意:由于鼠标事件也用本对象池,不正确的回收及调用,可能会影响鼠标事件的执行。

构造函数

  • 参数

    • caller: Object = null

      The execution context.

    • method: Function = null

      The handling function.

    • args: any[] = null

      Function arguments.

    • once: boolean = false

      Whether it should be executed only once.

    返回 Handler

    Constructor method.

    构造方法

属性

args: any[]

Arguments passed to the handler method.

参数。

caller: Object

The scope of the object (this).

执行域(this)。

method: Function

The handling method.

处理方法。

once: boolean = false

Indicates whether the handler should be executed only once. If true, the handler will be recovered after execution.After recycling, it will be reused, default to false.

表示是否只执行一次。如果为true,回调后执行recover()进行回收。回收后会被再利用,默认为false

方法

  • 参数

    • data: any

      Additional callback data, can be a single data or an Array (as multiple arguments).

    返回 any

    Executes the handler with additional data.

    执行处理器,并携带额外数据。

  • 参数

    • caller: any

      The scope of the object (this).

    • method: Function

      The callback method.

    • args: any[]

      The arguments to be passed to the method.

    • once: boolean = false

      Whether the handler should be executed only once. If true, the handler will be recovered after execution.

    返回 Handler

    Returns the handler itself.

    Sets the specified property values for this object.

    设置此对象的指定属性值。

  • 参数

    • caller: any

      The scope of the object (this).

    • method: Function

      The callback method.

    • args: any[] = null

      The arguments to be passed to the callback method.

    • once: boolean = true

      Whether the handler should be executed only once. If true, the handler will be recovered after execution.

    返回 Handler

    Return the created handler instance.

    Creates a Handler from the object pool. By default, the handler will execute once and then be recovered immediately. If automatic recovery is not desired, set the once parameter to false.

    从对象池内创建一个 Handler,默认会执行一次并立即回收。如果不需要自动回收,设置 once 参数为 false。

MMNEPVFCICPMFPCPTTAAATR