chromium/third_party/blink/renderer/modules/serial/serial.idl

// Copyright 2018 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/serial/#serial-interface

[
    Exposed(Window Serial, DedicatedWorker Serial),
    SecureContext
] interface Serial : EventTarget {
    attribute EventHandler onconnect;
    attribute EventHandler ondisconnect;

    [CallWith=ScriptState, RaisesException, MeasureAs=SerialGetPorts]
    Promise<sequence<SerialPort>> getPorts();

    [CallWith=ScriptState, RaisesException, MeasureAs=SerialRequestPort, Exposed=Window]
    Promise<SerialPort> requestPort(optional SerialPortRequestOptions options = {});
};