Skip to main content

Home > blockly > utils > browserEvents > bind

utils.browserEvents.bind() function

Bind an event handler that should be called regardless of whether it is part of the active touch stream. Use this for events that are not part of a multi-part gesture (e.g. mouseover for tooltips).

Signature:

export declare function bind(node: EventTarget, name: string, thisObject: object | null, func: Function, 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.
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_.