|
| 1 | +@JS() |
| 2 | +library network_information_types; |
| 3 | + |
| 4 | +import "package:js/js.dart"; |
| 5 | +import "dart:html" show EventListener, EventTarget; |
| 6 | + |
| 7 | +/// W3C Spec Draft http://wicg.github.io/netinfo/ |
| 8 | +/// Edition: Draft Community Group Report 20 February 2019 |
| 9 | +
|
| 10 | +/// http://wicg.github.io/netinfo/#navigatornetworkinformation-interface |
| 11 | +@anonymous |
| 12 | +@JS() |
| 13 | +abstract class Navigator implements NavigatorNetworkInformation {} |
| 14 | + |
| 15 | +@anonymous |
| 16 | +@JS() |
| 17 | +abstract class WorkerNavigator implements NavigatorNetworkInformation { |
| 18 | + external factory WorkerNavigator({NetworkInformation connection}); |
| 19 | +} |
| 20 | + |
| 21 | +/// http://wicg.github.io/netinfo/#navigatornetworkinformation-interface |
| 22 | +@anonymous |
| 23 | +@JS() |
| 24 | +abstract class NavigatorNetworkInformation { |
| 25 | + external NetworkInformation get connection; |
| 26 | + external factory NavigatorNetworkInformation({NetworkInformation connection}); |
| 27 | +} |
| 28 | + |
| 29 | +/// http://wicg.github.io/netinfo/#connection-types |
| 30 | +/*type ConnectionType = |
| 31 | + | 'bluetooth' |
| 32 | + | 'cellular' |
| 33 | + | 'ethernet' |
| 34 | + | 'mixed' |
| 35 | + | 'none' |
| 36 | + | 'other' |
| 37 | + | 'unknown' |
| 38 | + | 'wifi' |
| 39 | + | 'wimax'; |
| 40 | +*/ |
| 41 | + |
| 42 | +/// http://wicg.github.io/netinfo/#effectiveconnectiontype-enum |
| 43 | +/*type EffectiveConnectionType = '2g' | '3g' | '4g' | 'slow-2g';*/ |
| 44 | + |
| 45 | +/// http://wicg.github.io/netinfo/#dom-megabit |
| 46 | +/*type Megabit = number;*/ |
| 47 | +/// http://wicg.github.io/netinfo/#dom-millisecond |
| 48 | +/*type Millisecond = number;*/ |
| 49 | + |
| 50 | +/// http://wicg.github.io/netinfo/#networkinformation-interface |
| 51 | +@anonymous |
| 52 | +@JS() |
| 53 | +abstract class NetworkInformation implements EventTarget { |
| 54 | + /// http://wicg.github.io/netinfo/#type-attribute |
| 55 | + external String /*'bluetooth'|'cellular'|'ethernet'|'mixed'|'none'|'other'|'unknown'|'wifi'|'wimax'*/ get type; |
| 56 | + |
| 57 | + /// http://wicg.github.io/netinfo/#effectivetype-attribute |
| 58 | + external String /*'2g'|'3g'|'4g'|'slow-2g'*/ get effectiveType; |
| 59 | + |
| 60 | + /// http://wicg.github.io/netinfo/#downlinkmax-attribute |
| 61 | + external num get downlinkMax; |
| 62 | + |
| 63 | + /// http://wicg.github.io/netinfo/#downlink-attribute |
| 64 | + external num get downlink; |
| 65 | + |
| 66 | + /// http://wicg.github.io/netinfo/#rtt-attribute |
| 67 | + external num get rtt; |
| 68 | + |
| 69 | + /// http://wicg.github.io/netinfo/#savedata-attribute |
| 70 | + external bool get saveData; |
| 71 | + |
| 72 | + /// http://wicg.github.io/netinfo/#handling-changes-to-the-underlying-connection |
| 73 | + external EventListener get onchange; |
| 74 | + external set onchange(EventListener v); |
| 75 | +} |
| 76 | + |
| 77 | +@JS() |
| 78 | +external Navigator get navigator; |
0 commit comments