Support for multiple data arguments + acks

This commit is contained in:
Thomas Reichling 2018-01-30 00:23:10 +01:00 committed by GitHub
parent 8951667903
commit 86cf519185
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,8 +21,13 @@ export default class{
var super_onevent = this.Socket.onevent; var super_onevent = this.Socket.onevent;
this.Socket.onevent = (packet) => { this.Socket.onevent = (packet) => {
super_onevent.call(this.Socket, packet); super_onevent.call(this.Socket, packet);
Emitter.emit(packet.data[0], packet.data[1]); let args = [...packet.data]
if(packet.id !== null)
args.push(this.Socket.ack(packet.id))
Emitter.emit.apply(Emitter, args)
if(this.store) this.passToStore('SOCKET_'+packet.data[0], [ ...packet.data.slice(1)]) if(this.store) this.passToStore('SOCKET_'+packet.data[0], [ ...packet.data.slice(1)])
}; };