UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue)

34 lines (29 loc) 764 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; function _default() { var allHandlers = new Map(); return { on: function on(type, handler) { var handlers = allHandlers.get(type); if (!handlers) handlers = [handler];else handlers.push(handler); allHandlers.set(type, handlers); }, off: function off(type, handler) { var handlers = allHandlers.get(type); if (handlers) { handlers.splice(handlers.indexOf(handler) >>> 0, 1); } }, emit: function emit(type, evt) { var handlers = allHandlers.get(type); if (handlers) { handlers.slice().map(function (handler) { handler(evt); }); } } }; }