Skip to content

Commit

Permalink
Add NetworkInformation.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim committed Jul 11, 2023
1 parent 6c40e65 commit 1dd013d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/streaming/NetworkInformation.d.ts
Original file line number Diff line number Diff line change
@@ -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 {}

0 comments on commit 1dd013d

Please sign in to comment.