Skip to content

Commit

Permalink
feature: make port parameter a string (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
levivilet authored Sep 13, 2024
1 parent 3f6cff6 commit bceaf17
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/parts/StartWebViewServer/StartWebViewServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 1 addition & 4 deletions src/parts/WaitForServerToBeReady/WaitForServerToBeReady.ts
Original file line number Diff line number Diff line change
@@ -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<void>()
server.listen(port, resolve)
await promise
Expand Down
2 changes: 1 addition & 1 deletion src/parts/WebViewServerTypes/WebViewServerTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit bceaf17

Please sign in to comment.