UNPKG

@webeach/event-manager

Version:

EventManager is a library for simplifying event handling in JavaScript

24 lines (22 loc) 830 B
function validateEventObject(event) { return event instanceof Event; } function validateEventType(eventType) { return typeof eventType === 'string' && eventType !== ''; } function validateHandler(handler) { return typeof handler === 'function'; } function validateHandlerList(handlerList) { return Array.isArray(handlerList) ? handlerList.every(validateHandler) : validateHandler(handlerList); } function validateTargetType(target) { // return target instanceof EventTarget return (typeof target.addEventListener === 'function' && typeof target.removeEventListener === 'function' && typeof target.dispatchEvent === 'function'); } export { validateEventObject, validateEventType, validateHandler, validateHandlerList, validateTargetType }; //# sourceMappingURL=utils.js.map