Skip to content
On this page

Home > @taiyuuki/utils > EventsController

EventsController class

This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

DOM Event Controller

Signature:

typescript
declare class EventsController<T extends EventTarget>
declare class EventsController<T extends EventTarget>

Example

ts
const evt_ctrl = new EventsController(el)
evt_ctrl.add_evt('click', callback1)
evt_ctrl.add_evt('keypress', callback2)
evt_ctrl.remove_all()
const evt_ctrl = new EventsController(el)
evt_ctrl.add_evt('click', callback1)
evt_ctrl.add_evt('keypress', callback2)
evt_ctrl.remove_all()

Constructors

ConstructorModifiersDescription
(constructor)(target)(BETA) Constructs a new instance of the EventsController class

Methods

MethodModifiersDescription
add_evt(type, callback)(BETA) 绑定事件
remove_all()(BETA) 解除所有绑定的事件

Released under the MIT License.