chromium/third_party/blink/renderer/modules/netinfo/network_information.idl

// Copyright 2014 The Chromium Authors
// 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, HighEntropy=Direct, MeasureAs=NetInfoType] readonly attribute ConnectionType type;
    [RuntimeEnabled=NetInfoDownlinkMax, HighEntropy=Direct, MeasureAs=NetInfoDownlinkMax] readonly attribute Megabit downlinkMax;
    [MeasureAs=NetInfoOnChange] attribute EventHandler onchange;
    [RuntimeEnabled=NetInfoDownlinkMax, MeasureAs=NetInfoOnTypeChange] attribute EventHandler ontypechange;
    [HighEntropy=Direct, MeasureAs=NetInfoEffectiveType] readonly attribute EffectiveConnectionType effectiveType;
    [HighEntropy=Direct, MeasureAs=NetInfoRtt] readonly attribute Milliseconds rtt;
    [HighEntropy=Direct, MeasureAs=NetInfoDownlink] readonly attribute Megabit downlink;
    [HighEntropy=Direct, MeasureAs=NetInfoSaveData] readonly attribute boolean saveData;
};