import { EventHandler } from '../types'; /** * Implement the adapter pattern to the native DOM event methods. * So we are able to make references on the events we created, * and remove them completely when we don't need them. * * Source: * https://github.com/terrylinooo/sliderm.js/blob/master/src/core/events/event-adapter.js */ export default class EventAdapter { private target; private events; /** * Constructor. */ constructor(target: EventTarget); /** * Adds an event listener to the target element. */ on(event: string, handler: EventHandler): void; /** * Removes an event listener from the target element. */ off(event: string): void; /** * Dispatches an event on the target element. */ emit(event: string): void; /** * Destroys all event listeners associated with the target element. */ destroy(): void; /** * Mocks the dispatch of an event for the current target. * Mainly used for testing purposes. */ mock(event: string, dispatchEvent: Event): void; }