diff --git a/build/flecks.yml b/build/flecks.yml index 55ea2d7..3bdb47f 100644 --- a/build/flecks.yml +++ b/build/flecks.yml @@ -98,7 +98,7 @@ '@flecks/web/client': up: - '@flecks/socket' - - '@humus/universe' + - '@humus/app' - '@flecks/react' - '...' '@flecks/web/server': diff --git a/packages/app/package.json b/packages/app/package.json index 9f3293d..0044b92 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -17,6 +17,8 @@ "files": [ "assets", "build", + "client.js", + "client.js.map", "index.css", "index.css.map", "index.js", @@ -31,6 +33,8 @@ "@avocado/input": "^3.0.0", "@avocado/math": "^3.0.0", "@avocado/react": "^3.0.0", + "@avocado/resource": "^3.0.0", + "@avocado/s13n": "^3.0.0", "@avocado/topdown": "^3.0.0", "@flecks/core": "^1.4.1", "@flecks/react": "^1.4.1", diff --git a/packages/universe/src/client/index.js b/packages/app/src/client/index.js similarity index 63% rename from packages/universe/src/client/index.js rename to packages/app/src/client/index.js index 0c538b5..a308af1 100644 --- a/packages/universe/src/client/index.js +++ b/packages/app/src/client/index.js @@ -8,8 +8,8 @@ export default { window.flecks = flecks; const Synchronizer = Receiver(flecks); const synchronizer = new Synchronizer(); - flecks.set('$humus/universe.synchronizer', synchronizer); - flecks.get('$flecks/socket.socket').on('packet', synchronizer.acceptPacket, synchronizer); + flecks.set('$humus/app.synchronizer', synchronizer); + synchronizer.listenTo(flecks.get('$flecks/socket.socket')); }, }, }; diff --git a/packages/universe/src/client/receiver.js b/packages/app/src/client/receiver.js similarity index 88% rename from packages/universe/src/client/receiver.js rename to packages/app/src/client/receiver.js index 5a99a31..493a328 100644 --- a/packages/universe/src/client/receiver.js +++ b/packages/app/src/client/receiver.js @@ -19,5 +19,9 @@ export default (flecks) => { } } + listenTo(socket) { + socket.on('packet', this.acceptPacket, this); + } + }; }; diff --git a/packages/app/src/hooks/use-room.js b/packages/app/src/hooks/use-room.js index b315e96..a9473d1 100644 --- a/packages/app/src/hooks/use-room.js +++ b/packages/app/src/hooks/use-room.js @@ -9,7 +9,7 @@ export default () => { const flecks = useFlecks(); const [room, setRoom] = useState(flecks.get('$humus/app.room')); const socket = useSocket(); - const synchronizer = flecks.get('$humus/universe.synchronizer'); + const synchronizer = flecks.get('$humus/app.synchronizer'); useEffect(() => { if (!room) { return undefined; diff --git a/packages/universe/package.json b/packages/universe/package.json index a487303..09c8195 100644 --- a/packages/universe/package.json +++ b/packages/universe/package.json @@ -19,8 +19,6 @@ "files": [ "assets", "build", - "client.js", - "client.js.map", "index.css", "index.css.map", "index.js", @@ -34,7 +32,6 @@ ], "dependencies": { "@avocado/resource": "^3.0.0", - "@avocado/s13n": "^3.0.0", "@avocado/timing": "^3.0.0", "@avocado/traits": "^3.0.0", "@flecks/core": "^1.4.1",