From 0e14d167dcc14534a67096b77a669dfa120e1994 Mon Sep 17 00:00:00 2001 From: Samuel Elliott Date: Sat, 31 Mar 2018 17:38:11 +0100 Subject: [PATCH] Fix event callbacks not being passed any arguments --- client/src/modules/eventswrapper.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/modules/eventswrapper.js b/client/src/modules/eventswrapper.js index 8196e561..bd8ece2b 100644 --- a/client/src/modules/eventswrapper.js +++ b/client/src/modules/eventswrapper.js @@ -23,14 +23,14 @@ export default class EventsWrapper { get on() { return this.subscribe } subscribe(event, callback) { if (this.eventSubs.find(e => e.event === event && e.callback === callback)) return; - const boundCallback = () => callback.apply(this.bind, arguments); + const boundCallback = (...args) => callback.apply(this.bind, args); this.eventSubs.push({ event, callback, boundCallback }); eventemitters.get(this).on(event, boundCallback); } once(event, callback) { if (this.eventSubs.find(e => e.event === event && e.callback === callback)) return; - const boundCallback = () => this.off(event, callback) && callback.apply(this.bind, arguments); + const boundCallback = (...args) => this.off(event, callback) && callback.apply(this.bind, args); this.eventSubs.push({ event, callback, boundCallback }); eventemitters.get(this).on(event, boundCallback); } @@ -50,4 +50,5 @@ export default class EventsWrapper { } this.eventSubs.splice(0, this.eventSubs.length); } + }