From 1dd013ddb56aa332dab27a4a522fb126ca81de81 Mon Sep 17 00:00:00 2001 From: William Wong Date: Tue, 11 Jul 2023 02:58:21 -0700 Subject: [PATCH] Add NetworkInformation.d.ts --- src/streaming/NetworkInformation.d.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/streaming/NetworkInformation.d.ts diff --git a/src/streaming/NetworkInformation.d.ts b/src/streaming/NetworkInformation.d.ts new file mode 100644 index 00000000..12c6e96f --- /dev/null +++ b/src/streaming/NetworkInformation.d.ts @@ -0,0 +1,24 @@ +declare global { + // This is subset of https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation. + interface NetworkInformation extends EventTarget { + addEventListener( + type: 'change', + listener: EventListener | EventListenerObject, + options?: AddEventListenerOptions | boolean + ): void; + + removeEventListener( + type: 'change', + listener: EventListener | EventListenerObject, + options?: AddEventListenerOptions | boolean + ): void; + + get type(): 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'other' | 'unknown' | 'wifi' | 'wimax'; + } + + interface Navigator { + get connection(): NetworkInformation; + } +} + +export {}