unfc
Version:
A framework-agnostic NFC package for reading/writing NFC tags in web apps and PWAs
35 lines (34 loc) • 953 B
TypeScript
import { NFCDefinition } from "./definitions.js";
/**
* A simplified API for common NFC reading operations
*/
export declare class SimpleNfc {
private nfc;
private scanCallback;
constructor();
/**
* Check if NFC is available on this device/browser
*/
isAvailable(): Promise<boolean>;
/**
* Start scanning for NFC tags with a simplified callback
* The callback will receive text content and content type ('text', 'url', or 'other')
*/
startReading(callback: (content: string, type: string) => void): Promise<void>;
/**
* Stop scanning for NFC tags
*/
stopReading(): Promise<void>;
/**
* Write a simple text to an NFC tag
*/
writeText(text: string): Promise<void>;
/**
* Write a URL to an NFC tag
*/
writeUrl(url: string): Promise<void>;
/**
* Read a simple NFC tag
*/
read(): NFCDefinition;
}