Skip to main content

Home > blockly > utils > browserEvents > conditionalBind

utils.browserEvents.conditionalBind() function

Bind an event handler that can be ignored if it is not part of the active touch stream. Use this for events that either start or continue a multi-part gesture (e.g. mousedown or mousemove, which may be part of a drag or click).

Signature:

export declare function conditionalBind(node: EventTarget, name: string, thisObject: object | null, func: Function, opt_noCaptureIdentifier?: boolean, options?: AddEventListenerOptions): Data;

Parameters

ParameterTypeDescription
nodeEventTargetNode upon which to listen.
namestringEvent name to listen to (e.g. 'mousedown').
thisObjectobject | nullThe value of 'this' in the function.
funcFunctionFunction to call when event is triggered.
opt_noCaptureIdentifierboolean(Optional) True if triggering on this event should not block execution of other event handlers on this touch or other simultaneous touches. False by default.
optionsAddEventListenerOptions(Optional) An object with options controlling the behavior of the event listener. Passed through directly as the third argument to addEventListener.

Returns:

Data

Opaque data that can be passed to unbindEvent_.