UNPKG

1.1 kBTypeScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @format
8 */
9import { NetInfoNativeModule } from './privateTypes';
10declare type ConnectionType = 'bluetooth' | 'cellular' | 'ethernet' | 'mixed' | 'none' | 'other' | 'unknown' | 'wifi' | 'wimax';
11declare type ConnectionEffectiveType = '2g' | '3g' | '4g' | 'slow-2g';
12declare type ConnectionSaveData = boolean;
13interface Events {
14 change: Event;
15}
16interface Connection {
17 type: ConnectionType;
18 effectiveType: ConnectionEffectiveType;
19 saveData: ConnectionSaveData;
20 addEventListener<K extends keyof Events>(type: K, listener: (event: Events[K]) => void): void;
21 removeEventListener<K extends keyof Events>(type: K, listener: (event: Events[K]) => void): void;
22}
23declare global {
24 interface Navigator {
25 connection?: Connection;
26 mozConnection?: Connection;
27 webkitConnection?: Connection;
28 }
29}
30declare const RNCNetInfo: NetInfoNativeModule;
31export default RNCNetInfo;
32
\No newline at end of file