Wings Engine

Listening to events and responding

There are some interactive events on elements that can be listened and responded to in the secondary development code. The most common one is the mouse event. Currently, there are three supported mouse events: click, mouseenter, and mouseleave. Let’s use a simple case to look at the processing of mouse events:

1
2
3
4
5
6
7
8
9
class ExtensionSample {
init() {
this.element.addEventListener("click", () => {
console.log("Button clicked");
});
}
}

export default ExtensionSample;

The effect after clicking the button: