refactor: return flushed instead of callback
This commit is contained in:
parent
a66b6889f2
commit
40eb5867ee
|
@ -23,11 +23,16 @@ export class EntityPacketSynchronizer {
|
|||
}
|
||||
|
||||
flushPackets(flusher) {
|
||||
for (const [entity, packets] of this.packetsToSynchronize.entries()) {
|
||||
const flushed = new Map();
|
||||
const it = this.packetsToSynchronize.entries();
|
||||
for (let value = it.next(); !value.done; value = it.next()) {
|
||||
const entity = value.value[0];
|
||||
const packets = value.value[1];
|
||||
const mergedPackets = this._mergePackets(packets);
|
||||
flusher(entity, Array.from(mergedPackets.values()));
|
||||
flushed.set(entity, mergedPackets);
|
||||
}
|
||||
this.packetsToSynchronize.clear();
|
||||
return flushed;
|
||||
}
|
||||
|
||||
_mergePackets(packets) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user