Stay organized with collections
Save and categorize content based on your preferences.
blockly > browserEvents > bind
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): Data;
Parameters
Parameter |
Type |
Description |
node |
EventTarget |
Node upon which to listen. |
name |
string |
Event name to listen to (e.g. 'mousedown'). |
thisObject |
object | null |
The value of 'this' in the function. |
func |
Function |
Function to call when event is triggered. |
Returns:
Data
Opaque data that can be passed to unbindEvent_.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["The `browserEvents.bind()` function attaches an event handler to a node, ensuring it's called irrespective of touch interactions."],["This function is best suited for events outside multi-part gestures, like tooltips triggered by mouseovers."],["It requires the target node, event name, 'this' context for the handler function, and the handler function itself as arguments."],["Upon successful binding, it returns an opaque data object for later event removal using `unbindEvent_`."]]],["The `browserEvents.bind()` function registers an event handler for a specified event on a given node. It accepts the node, event name, the `this` object for the callback, and the callback function itself as parameters. This method is designed for events outside of multi-part gestures, such as 'mouseover'. Upon execution, it returns data used for unbinding the event later.\n"]]