diff --git a/backend/instance.ts b/backend/instance.ts index 7d57154..d751d86 100644 --- a/backend/instance.ts +++ b/backend/instance.ts @@ -132,7 +132,7 @@ export class Instances { wss, JSON.stringify({ type: "updates", - updates: updates.map(([update]) => update), + updates: updates.map((update) => update), }), ); }, diff --git a/backend/message.test.ts b/backend/message.test.ts index f1e6068..3f462eb 100644 --- a/backend/message.test.ts +++ b/backend/message.test.ts @@ -27,7 +27,7 @@ test("distribute to self", () => { return true; }, 0); - client0.sendUpdate({ payload: "Hello" }, "") ; + client0.sendUpdate({ payload: "Hello" }, ""); expect(client0Heard).toMatchObject([ { payload: "Hello", serial: 1, max_serial: 1 }, @@ -80,7 +80,7 @@ test("distribute to self and other", () => { ]); expect(client1Heard).toMatchObject([ { payload: "Hello", serial: 1, max_serial: 1 }, - { payload: "Bye", serial: 2, max_serial: 2 } + { payload: "Bye", serial: 2, max_serial: 2 }, ]); expect(prepare(getMessages())).toEqual([ @@ -652,7 +652,6 @@ test("distribute to self and other, but other was disconnected", () => { type: "sent", instanceId: "3001", update: { payload: "Hello", serial: 1, max_serial: 1 }, - }, { type: "received", diff --git a/backend/message.ts b/backend/message.ts index 6d51b5b..cab5fc2 100644 --- a/backend/message.ts +++ b/backend/message.ts @@ -6,9 +6,7 @@ import type { import type { Message } from "../types/message"; import { getColorForId } from "./color"; -type UpdateListenerMulti = ( - updates: ReceivedStatusUpdate[], -) => boolean; +type UpdateListenerMulti = (updates: ReceivedStatusUpdate[]) => boolean; type ClearListener = () => boolean; type DeleteListener = () => boolean; @@ -150,10 +148,7 @@ class Processor implements IProcessor { this.clients.splice(client_index, 1); } - distribute( - instanceId: string, - update: SendingStatusUpdate, - ) { + distribute(instanceId: string, update: SendingStatusUpdate) { this.currentSerial++; const receivedUpdate: ReceivedStatusUpdate = { ...update, @@ -187,9 +182,7 @@ class Processor implements IProcessor { updateListener( this.updates .slice(serial) - .map((update) => - ({ ...update, max_serial: maxSerial }) - ), + .map((update) => ({ ...update, max_serial: maxSerial })), ); } } diff --git a/sim/create.ts b/sim/create.ts index afe5e8c..aa60079 100644 --- a/sim/create.ts +++ b/sim/create.ts @@ -1,4 +1,4 @@ -import { WebXdc, ReceivedStatusUpdate } from "@webxdc/types"; +import { Webxdc, ReceivedStatusUpdate } from "@webxdc/types"; type UpdatesMessage = { type: "updates"; @@ -45,11 +45,11 @@ type Log = (...args: any[]) => void; export function createWebXdc( transport: Transport, log: Log = () => {}, -): WebXdc { +): Webxdc { let resolveUpdateListenerPromise: (() => void) | null = null; - const webXdc: WebXdc = { - sendUpdate: (update) => { + const webXdc: Webxdc = { + sendUpdate: (update: any) => { transport.send({ type: "sendUpdate", update }); log("send", { update }); }, diff --git a/sim/webxdc.test.ts b/sim/webxdc.test.ts index a2fe1f1..8847cd9 100644 --- a/sim/webxdc.test.ts +++ b/sim/webxdc.test.ts @@ -27,7 +27,7 @@ class FakeTransport implements Transport { send(data: any) { if (data.type === "sendUpdate") { - const { update} = data; + const { update } = data; this.client.sendUpdate(update, ""); } else if (data.type === "setUpdateListener") { this.client.connect( diff --git a/sim/webxdc.ts b/sim/webxdc.ts index f7739a8..7d0130b 100644 --- a/sim/webxdc.ts +++ b/sim/webxdc.ts @@ -1,4 +1,4 @@ -import { WebXdc } from "@webxdc/types"; +import { Webxdc } from "@webxdc/types"; import { Transport, TransportMessageCallback, @@ -114,7 +114,7 @@ export class DevServerTransport implements Transport { } } -function getWebXdc(): WebXdc { +function getWebXdc(): Webxdc { return (window as any).webxdc; }