Function useWebNFC

  • Returns {
        cleanup: () => void;
        createJsonRecord: (data: object) => NFCRecord;
        createMimeRecord: (mediaType: string, data: any) => NFCRecord;
        createTextRecord: (text: string, lang?: string) => NFCRecord;
        createUrlRecord: (url: string) => NFCRecord;
        isSupported: boolean;
        read: (options?: NFCReadingOptions) => Promise<null | NDEFMessage>;
        scan: (options?: NFCReaderOptions) => Promise<NDEFReader>;
        startScanning: (
            options?: NFCReadingOptions,
            onReading?: (message: any, serialNumber: string) => void,
            onReadingError?: (error: Error) => void,
        ) => Promise<void>;
        stopScanning: () => void;
        write: (
            message: NDEFMessageInit,
            options?: NFCWriteOptions,
        ) => Promise<void>;
        writeTag: (
            records: NFCRecord[],
            options?: NFCWriteOptions,
        ) => Promise<void>;
        get state(): WebNFCState;
        subscribe(callback: (state: WebNFCState) => void): () => boolean;
    }

    • cleanup: () => void
    • createJsonRecord: (data: object) => NFCRecord
    • createMimeRecord: (mediaType: string, data: any) => NFCRecord
    • createTextRecord: (text: string, lang?: string) => NFCRecord
    • createUrlRecord: (url: string) => NFCRecord
    • isSupported: boolean
    • read: (options?: NFCReadingOptions) => Promise<null | NDEFMessage>
    • scan: (options?: NFCReaderOptions) => Promise<NDEFReader>
    • startScanning: (
          options?: NFCReadingOptions,
          onReading?: (message: any, serialNumber: string) => void,
          onReadingError?: (error: Error) => void,
      ) => Promise<void>
    • stopScanning: () => void
    • write: (message: NDEFMessageInit, options?: NFCWriteOptions) => Promise<void>
    • writeTag: (records: NFCRecord[], options?: NFCWriteOptions) => Promise<void>
    • get state(): WebNFCState
    • subscribe:function
      • Parameters

        • callback: (state: WebNFCState) => void

        Returns () => boolean