From 1093a71896ff02a7034696990078054ae3a8020d Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 17 May 2022 11:37:34 +0000 Subject: fix(server): re-static #hostname and #port --- examples/my_cool_server.ts | 2 +- laurali/server.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/my_cool_server.ts b/examples/my_cool_server.ts index 3cf3b6d..793e01f 100644 --- a/examples/my_cool_server.ts +++ b/examples/my_cool_server.ts @@ -72,7 +72,7 @@ class MyCoolServer extends Server { override onListen() { MyCoolServer.logger.info( - `Listening on ${this.hostname}:${this.port}.`, + `Listening on ${MyCoolServer.hostname}:${MyCoolServer.port}.`, ); } } diff --git a/laurali/server.ts b/laurali/server.ts index e6706b4..b647dc2 100644 --- a/laurali/server.ts +++ b/laurali/server.ts @@ -39,9 +39,9 @@ export abstract class Server { /** All registered hook functions of the `Server` */ static #hooks: Map void> = new Map(); /** The port of the `Server` */ - #port: number; + static #port: number; /** The hostname of the `Server` */ - #hostname: string; + static #hostname: string; /** * @param certFile The path to the public key file of the `Server` @@ -56,8 +56,8 @@ export abstract class Server { const port = config?.port || 1965; const hostname = config?.hostname || "0.0.0.0"; - this.#port = port; - this.#hostname = hostname; + Server.#port = port; + Server.#hostname = hostname; this.#listener = Deno.listenTls({ port, @@ -78,13 +78,13 @@ export abstract class Server { } /** Get the `port` of the `Server` */ - get port() { - return this.#port; + static get port() { + return Server.#port; } /** Get the `hostname` of the `Server` */ - get hostname() { - return this.#hostname; + static get hostname() { + return Server.#hostname; } /** Called before a connection to a client has been responded to */ -- cgit v1.2.3