From ffb5363536664ac9b9c6f96beabb653437ce1137 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 17 May 2022 07:44:28 +0000 Subject: feat(server): un-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 793e01f..3cf3b6d 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 ${MyCoolServer.hostname}:${MyCoolServer.port}.`, + `Listening on ${this.hostname}:${this.port}.`, ); } } diff --git a/laurali/server.ts b/laurali/server.ts index b2a2446..bd2ff87 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` */ - static #port: number; + #port: number; /** The hostname of the `Server` */ - static #hostname: string; + #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"; - Server.#port = port; - Server.#hostname = hostname; + this.#port = port; + this.#hostname = hostname; this.#listener = Deno.listenTls({ port, @@ -78,13 +78,13 @@ export abstract class Server { } /** Get the `port` of the `Server` */ - static get port() { - return Server.#port; + get port() { + return this.#port; } /** Get the `hostname` of the `Server` */ - static get hostname() { - return Server.#hostname; + get hostname() { + return this.#hostname; } /** Called before a connection to a client has been responded to */ -- cgit v1.2.3