blob: fdb729a806ab9f87e88bfce4fd9663a626fd2793 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://wicg.github.io/netinfo/#the-networkinformation-interface
enum ConnectionType {
"cellular",
"bluetooth",
"ethernet",
"wifi",
"wimax",
"other",
"none",
"unknown"
};
enum EffectiveConnectionType {
"slow-2g",
"2g",
"3g",
"4g"
};
typedef unrestricted double Megabit;
typedef unsigned long long Milliseconds;
[
ActiveScriptWrappable,
Exposed=(Window,Worker)
] interface NetworkInformation : EventTarget {
[RuntimeEnabled=NetInfoDownlinkMax, MeasureAs=NetInfoType] readonly attribute ConnectionType type;
[RuntimeEnabled=NetInfoDownlinkMax, MeasureAs=NetInfoDownlinkMax] readonly attribute Megabit downlinkMax;
[MeasureAs=NetInfoOnChange] attribute EventHandler onchange;
[RuntimeEnabled=NetInfoDownlinkMax, MeasureAs=NetInfoOnTypeChange] attribute EventHandler ontypechange;
[MeasureAs=NetInfoEffectiveType] readonly attribute EffectiveConnectionType effectiveType;
[MeasureAs=NetInfoRtt] readonly attribute Milliseconds rtt;
[MeasureAs=NetInfoDownlink] readonly attribute Megabit downlink;
[MeasureAs=NetInfoSaveData] readonly attribute boolean saveData;
};