From 944eaef3ee446f5544a0658d71567ab1cc293f91 Mon Sep 17 00:00:00 2001 From: David Murdoch Date: Sun, 23 Aug 2020 17:56:27 -0400 Subject: [PATCH] Add `listen(port, options, callback)` overload to TS def (#357) --- docs/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/index.d.ts b/docs/index.d.ts index 480ea65..e3fc5b8 100644 --- a/docs/index.d.ts +++ b/docs/index.d.ts @@ -241,12 +241,19 @@ export interface AppOptions { ssl_prefer_low_memory_usage?: boolean; } +export enum ListenOptions { + LIBUS_LISTEN_DEFAULT = 0, + LIBUS_LISTEN_EXCLUSIVE_PORT = 1 +} + /** TemplatedApp is either an SSL or non-SSL app. See App for more info, read user manual. */ export interface TemplatedApp { /** Listens to hostname & port. Callback hands either false or a listen socket. */ listen(host: RecognizedString, port: number, cb: (listenSocket: us_listen_socket) => void): TemplatedApp; /** Listens to port. Callback hands either false or a listen socket. */ listen(port: number, cb: (listenSocket: any) => void): TemplatedApp; + /** Listens to port and sets Listen Options. Callback hands either false or a listen socket. */ + listen(port: number, options: ListenOptions, cb: (listenSocket: us_listen_socket | false) => void): TemplatedApp; /** Registers an HTTP GET handler matching specified URL pattern. */ get(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; /** Registers an HTTP POST handler matching specified URL pattern. */