chromium/third_party/blink/renderer/modules/nfc/ndef_reader.idl

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://w3c.github.io/web-nfc/#dom-ndefmessagesource
typedef (DOMString or BufferSource or NDEFMessageInit) NDEFMessageSource;

// http://w3c.github.io/web-nfc/#dom-ndefreader

[
    RuntimeEnabled=WebNFC,
    ActiveScriptWrappable,
    SecureContext,
    Exposed=Window
] interface NDEFReader : EventTarget {
    [CallWith=ExecutionContext] constructor();
    attribute EventHandler onreading;
    attribute EventHandler onreadingerror;

    [CallWith=ScriptState, RaisesException, MeasureAs=WebNfcNdefReaderScan] Promise<undefined> scan(
        optional NDEFScanOptions options={});

    [CallWith=ScriptState, RaisesException, MeasureAs=WebNfcNdefWriterWrite] Promise<undefined> write(
        NDEFMessageSource message,
        optional NDEFWriteOptions options={});

    [CallWith=ScriptState, RaisesException, MeasureAs=WebNfcNdefMakeReadOnly] Promise<undefined> makeReadOnly(
        optional NDEFMakeReadOnlyOptions options={});
};