Fix power button actions

This commit is contained in:
Dane Everitt 2019-02-09 17:37:44 -08:00
parent 8385ec7feb
commit 5cb57af193
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 11 additions and 7 deletions

View file

@ -15,7 +15,7 @@ export default new class SocketEmitter {
/**
* Add an event listener for socket events.
*/
addListener(event: string | number, callback: (data: any) => void, vm: ComponentOptions<Vue>) {
addListener(event: string | number, callback: (...data: any[]) => void, vm: ComponentOptions<Vue>) {
if (!isFunction(callback)) {
return;
}
@ -31,7 +31,7 @@ export default new class SocketEmitter {
/**
* Remove an event listener for socket events based on the context passed through.
*/
removeListener(event: string | number, callback: (data: any) => void, vm: ComponentOptions<Vue>) {
removeListener(event: string | number, callback: (...data: any[]) => void, vm: ComponentOptions<Vue>) {
if (!isFunction(callback) || !this.listeners.has(event)) {
return;
}
@ -53,7 +53,8 @@ export default new class SocketEmitter {
*/
emit(event: string | number, ...args: any) {
(this.listeners.get(event) || []).forEach((listener) => {
listener.callback.call(listener.vm, args);
// @ts-ignore
listener.callback.call(listener.vm, ...args);
});
}
}