Support multiple arguments in eventbus emit

Fixes confirm dialog callback
This commit is contained in:
Pavel Djundik 2020-04-27 21:45:47 +03:00
parent 16646e1586
commit 61d8884bef

View file

@ -36,13 +36,13 @@ class EventBus {
* @param {String} type The event type to invoke. * @param {String} type The event type to invoke.
* @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler. * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler.
*/ */
emit(type, evt) { emit(type, ...evt) {
if (events.has(type)) { if (events.has(type)) {
events events
.get(type) .get(type)
.slice() .slice()
.map((handler) => { .map((handler) => {
handler(evt); handler(...evt);
}); });
} }
} }