Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
more renames
  • Loading branch information
Septias committed Dec 16, 2024
1 parent f1635e0 commit 63f3b90
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion backend/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class Instances {
wss,
JSON.stringify({
type: "updates",
updates: updates.map(([update]) => update),
updates: updates.map((update) => update),
}),
);
},
Expand Down
5 changes: 2 additions & 3 deletions backend/message.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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([
Expand Down Expand Up @@ -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",
Expand Down
13 changes: 3 additions & 10 deletions backend/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import type {
import type { Message } from "../types/message";
import { getColorForId } from "./color";

type UpdateListenerMulti = (
updates: ReceivedStatusUpdate<any>[],
) => boolean;
type UpdateListenerMulti = (updates: ReceivedStatusUpdate<any>[]) => boolean;

type ClearListener = () => boolean;
type DeleteListener = () => boolean;
Expand Down Expand Up @@ -150,10 +148,7 @@ class Processor implements IProcessor {
this.clients.splice(client_index, 1);
}

distribute(
instanceId: string,
update: SendingStatusUpdate<any>,
) {
distribute(instanceId: string, update: SendingStatusUpdate<any>) {
this.currentSerial++;
const receivedUpdate: ReceivedStatusUpdate<any> = {
...update,
Expand Down Expand Up @@ -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 })),
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions sim/create.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebXdc, ReceivedStatusUpdate } from "@webxdc/types";
import { Webxdc, ReceivedStatusUpdate } from "@webxdc/types";

type UpdatesMessage = {
type: "updates";
Expand Down Expand Up @@ -45,11 +45,11 @@ type Log = (...args: any[]) => void;
export function createWebXdc(
transport: Transport,
log: Log = () => {},
): WebXdc<any> {
): Webxdc<any> {
let resolveUpdateListenerPromise: (() => void) | null = null;

const webXdc: WebXdc<any> = {
sendUpdate: (update) => {
const webXdc: Webxdc<any> = {
sendUpdate: (update: any) => {
transport.send({ type: "sendUpdate", update });
log("send", { update });
},
Expand Down
2 changes: 1 addition & 1 deletion sim/webxdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions sim/webxdc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebXdc } from "@webxdc/types";
import { Webxdc } from "@webxdc/types";
import {
Transport,
TransportMessageCallback,
Expand Down Expand Up @@ -114,7 +114,7 @@ export class DevServerTransport implements Transport {
}
}

function getWebXdc(): WebXdc<any> {
function getWebXdc(): Webxdc<any> {
return (window as any).webxdc;
}

Expand Down

0 comments on commit 63f3b90

Please sign in to comment.