*Move setup emit until after the setup promise has resolved
This commit is contained in:
parent
f5127bd809
commit
0596a132f3
|
@ -199,8 +199,6 @@ export class Socket extends Client {
|
||||||
this.userData = null;
|
this.userData = null;
|
||||||
const mux = Protomux.from(this);
|
const mux = Protomux.from(this);
|
||||||
|
|
||||||
this.swarm.emit("setup", this);
|
|
||||||
|
|
||||||
let updateDone = defer();
|
let updateDone = defer();
|
||||||
const setup = defer();
|
const setup = defer();
|
||||||
|
|
||||||
|
@ -252,7 +250,8 @@ export class Socket extends Client {
|
||||||
await updateDone.promise;
|
await updateDone.promise;
|
||||||
};
|
};
|
||||||
mux.syncState = send.bind(undefined, mux);
|
mux.syncState = send.bind(undefined, mux);
|
||||||
return setup.promise;
|
await setup.promise;
|
||||||
|
this.swarm.emit("setup", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
on<T extends EventEmitter.EventNames<string | symbol>>(
|
on<T extends EventEmitter.EventNames<string | symbol>>(
|
||||||
|
|
Loading…
Reference in New Issue