From 6b5db29f4d785608f17d09a88b920f11aaed0627 Mon Sep 17 00:00:00 2001 From: Le Vivilet Date: Fri, 13 Sep 2024 21:03:23 +0200 Subject: [PATCH] feature: make port parameter a string --- src/parts/StartWebViewServer/StartWebViewServer.ts | 2 +- src/parts/WaitForServerToBeReady/WaitForServerToBeReady.ts | 5 +---- src/parts/WebViewServerTypes/WebViewServerTypes.ts | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/parts/StartWebViewServer/StartWebViewServer.ts b/src/parts/StartWebViewServer/StartWebViewServer.ts index c65738cd..66c1acab 100644 --- a/src/parts/StartWebViewServer/StartWebViewServer.ts +++ b/src/parts/StartWebViewServer/StartWebViewServer.ts @@ -2,7 +2,7 @@ import { VError } from '@lvce-editor/verror' import * as WaitForServerToBeReady from '../WaitForServerToBeReady/WaitForServerToBeReady.ts' import * as WebViewServerState from '../WebViewServerState/WebViewServerState.ts' -export const startWebViewServer = async (id: number, port: number) => { +export const startWebViewServer = async (id: number, port: string) => { try { const server = WebViewServerState.get(id) if (server.server.listening) { diff --git a/src/parts/WaitForServerToBeReady/WaitForServerToBeReady.ts b/src/parts/WaitForServerToBeReady/WaitForServerToBeReady.ts index 07906a96..c68331a6 100644 --- a/src/parts/WaitForServerToBeReady/WaitForServerToBeReady.ts +++ b/src/parts/WaitForServerToBeReady/WaitForServerToBeReady.ts @@ -1,10 +1,7 @@ import * as Promises from '../Promises/Promises.ts' import { WebViewServer } from '../WebViewServerTypes/WebViewServerTypes.ts' -export const waitForServerToBeReady = async ( - server: WebViewServer, - port: number, -) => { +export const waitForServerToBeReady = async (server: WebViewServer, port: string) => { const { resolve, promise } = Promises.withResolvers() server.listen(port, resolve) await promise diff --git a/src/parts/WebViewServerTypes/WebViewServerTypes.ts b/src/parts/WebViewServerTypes/WebViewServerTypes.ts index b93ce037..c6bd45c9 100644 --- a/src/parts/WebViewServerTypes/WebViewServerTypes.ts +++ b/src/parts/WebViewServerTypes/WebViewServerTypes.ts @@ -8,5 +8,5 @@ export interface WebViewServer { handler: Handler | undefined readonly setHandler: (handler: Handler) => void readonly server: Server - readonly listen: (port: number, callback: () => void) => void + readonly listen: (port: string, callback: () => void) => void }