Skip to content

Commit

Permalink
remove some stuff lol
Browse files Browse the repository at this point in the history
  • Loading branch information
lucsoft committed Oct 22, 2023
1 parent 5588b0b commit 991ab8c
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions pages/hosting/loading.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { HmRequest, LoginRequest, MessageType, PublishResponse, SubscribeRequest, TriggerRequest } from "https://deno.land/x/[email protected]/mod.ts";
import { API } from "shared";
import { Deferred, deferred } from "std/async/deferred.ts";
import { delay } from "std/async/delay.ts";
import { State, asPointer, lazyInit } from "webgen/mod.ts";
import { Server, ServerDetails, SidecarRequest, SidecarResponse } from "../../spec/music.ts";
import { activeUser, tokens } from "../_legacy/helper.ts";
Expand Down Expand Up @@ -127,7 +126,7 @@ export type RemotePath = {
export const currentFiles = asPointer(<RemotePath[]>[]);
export const currentPath = asPointer("/");
export let messageQueueSidecar = <{ request: SidecarRequest, response: Deferred<SidecarResponse>; }[]>[];
export const subscriberSidecar: ([id: string, (message: SidecarResponse) => void])[] = []
export const subscriberSidecar: ([ id: string, (message: SidecarResponse) => void ])[] = [];
let activeSideCar: Deferred<void> | undefined = undefined;
export const isSidecarConnect = asPointer(false);
export function stopSidecarConnection() {
Expand Down Expand Up @@ -157,9 +156,9 @@ export async function startSidecarConnection(id: string) {
break;
}
}
for (const iterator of subscriberSidecar) {
if (iterator[0] === id) {
iterator[1](msg);
for (const iterator of subscriberSidecar) {
if (iterator[ 0 ] === id) {
iterator[ 1 ](msg);
}
}
};
Expand All @@ -173,10 +172,8 @@ export async function startSidecarConnection(id: string) {
isSidecarConnect.setValue(true);
};

ws.onclose = async () => {
ws.onclose = () => {
if (!activeSideCar) return;
await delay(500);
activeSideCar = undefined;
isSidecarConnect.setValue(false);
clearInterval(watcher);
startSidecarConnection(id);
Expand Down

0 comments on commit 991ab8c

Please sign in to comment.