Core. Handler

Handler Event handler class.

It is recommended to use the Handler.create () method to create objects from the object pool, reducing object creation consumption. Created Handler After the object is no longer used, you can use Handler.recover () to recycle it into the object pool. Do not reuse this object after recovery, or it will lead to unpredictable errors.

Be careful: Because the mouse event is also using this object pool, incorrect recovery and invocation can affect the execution of the mouse event.

Constructor

new Handler(calleropt, methodopt, argsopt, once)

Creates a value based on the specified property value Handler Class instance.
Parameters:
Name Type Attributes Default Description
caller Object <optional>
null caller Execution domain.
method function <optional>
null method Processing function.
args Array <optional>
null args Function parameter.
once Boolean Do you execute only once?.

Member

args :Array

Parameter.

caller :Object

Execute domain (this).

method :function

Treatment method.

once :Boolean

Indicates whether it is executed only once. If true, callback recover () after the recovery, recovery will be re used, the default is false.

Methods

clear()

Clear object reference.

create(caller, method, argsopt, once) → {Handler}

Create a Handler from the object pool, which defaults to execute once and reclaims immediately, and if you don't need to automatically recycle, set the once parameter to false.
Parameters:
Name Type Attributes Default Description
caller Object Execute domain (this).
method function Callback method.
args Array <optional>
null args Carried parameters.
once Boolean Is it executed only once, and if true, recover () is executed after callback, the default is true.
Returns:
Type:
Handler
Returns the created handler instance.

recover()

Clean up and recycle to Handler Object pool.

run()

Executive processor.

runWith(data)

Execute the processor to carry additional data.
Parameters:
Name Type Description
data Object Additional callback data can be either single data or Array (as a multi parameter).

setTo(caller, method, args, once) → {Handler}

Sets the specified property value for this object.
Parameters:
Name Type Description
caller Object Execute domain (this).
method function Callback method.
args Array Carried parameters.
once Boolean Do you only execute once? If true, recover () is executed after execution.
Returns:
Type:
Handler
Return Handler Itself.