import * as I from 'immutable'; import {nextStep} from './next-step'; export class Synchronizer { constructor(children) { this.children = children; } acceptPacket(packet) { for (let i = 0; i < this.children.length; i++) { this.children[i].acceptPacket(packet); } } packetsForUpdate(force = false) { const packetsForUpdate = []; for (let i = 0; i < this.children.length; i++) { const childPacketsForUpdate = this.children[i].packetsForUpdate(force); for (let j = 0; j < childPacketsForUpdate.length; j++) { packetsForUpdate.push(childPacketsForUpdate[j]); } } return packetsForUpdate; } }