diff --git a/src/doodle3dbox.js b/src/doodle3dbox.js index 150cf5d..fad1a3b 100644 --- a/src/doodle3dbox.js +++ b/src/doodle3dbox.js @@ -9,12 +9,12 @@ import SystemAPI from './api/system.js'; import UpdateAPI from './api/update.js'; export default class Doodle3DBox extends EventDispatcher { - constructor(boxData) { + constructor(localip) { super(); - this.boxData = boxData; + this.localip = localip; - this.api = `http://${boxData.localip}/d3dapi/`; + this.api = `http://${localip}/d3dapi/`; this.alive = false; this.autoUpdate = false; diff --git a/src/doodle3dmanager.js b/src/doodle3dmanager.js index 05e13ae..be6c7ba 100644 --- a/src/doodle3dmanager.js +++ b/src/doodle3dmanager.js @@ -1,4 +1,3 @@ -import Doodle3DBox from './doodle3dbox.js'; import EventDispatcher from 'eventdispatcher.js'; import { sleep, parseFetch } from './utils.js'; @@ -47,16 +46,15 @@ export default class Doodle3DManager extends EventDispatcher { if (this.checkNonServerBoxes) boxes = boxes.concat(this.nonServerBoxes); - const knownIPsClient = this.boxes.map(box => box.boxData.localip); + const knownIPsClient = this.boxes.map(box => box.localip); const knownIPsServer = boxes.map(box => box.localip); const newBoxes = boxes.filter(box => knownIPsClient.indexOf(box.localip) === -1); - const removedBoxes = this.boxes.filter(box => knownIPsServer.indexOf(box.boxData.localip) === -1); + const removedBoxes = this.boxes.filter(box => knownIPsServer.indexOf(box.localip) === -1); let changed = false; for (const boxData of newBoxes) { - const box = new Doodle3DBox(boxData); - this._addBox(box); + this._addBox(boxData); changed = true; }