From 46676e84c22e64f815da08a7f4141011672da22e Mon Sep 17 00:00:00 2001 From: Mohamad Date: Tue, 4 Mar 2025 20:23:13 +0100 Subject: [PATCH] updated imports --- definitions.ts | 6 ++++++ index.ts | 10 +++++----- nfc.ts | 4 ++-- simple-nfc.ts | 13 +++++++++++-- utils.ts | 7 ++++++- web.ts | 12 +++++++++++- 6 files changed, 41 insertions(+), 11 deletions(-) diff --git a/definitions.ts b/definitions.ts index ff65932..61dd526 100644 --- a/definitions.ts +++ b/definitions.ts @@ -236,3 +236,9 @@ export interface NfcError extends Error { message: string; detail?: any; } + +export interface NFCDefinition { + // Define your NFC interface here + id: string; + data: string; +} diff --git a/index.ts b/index.ts index 093a748..107e901 100644 --- a/index.ts +++ b/index.ts @@ -1,5 +1,5 @@ -export * from "./definitions"; -export * from "./web"; -export * from "./nfc"; -export * from "./utils"; -export * from "./simple-nfc"; +export * from "./definitions.js"; +export * from "./web.js"; +export * from "./nfc.js"; +export * from "./utils.js"; +export * from "./simple-nfc.js"; diff --git a/nfc.ts b/nfc.ts index 848d952..c9fb72d 100644 --- a/nfc.ts +++ b/nfc.ts @@ -8,8 +8,8 @@ import { ShareOptions, PluginListenerHandle, NfcErrorType, -} from "./definitions"; -import { WebNfc } from "./web"; +} from "./definitions.js"; +import { WebNfc } from "./web.js"; /** * Main NFC class that provides access to NFC functionality. diff --git a/simple-nfc.ts b/simple-nfc.ts index ea69b97..2c485be 100644 --- a/simple-nfc.ts +++ b/simple-nfc.ts @@ -1,5 +1,6 @@ -import { Nfc } from "./nfc"; -import { NfcUtils } from "./utils"; +import { Nfc } from "./nfc.js"; +import { NfcUtils } from "./utils.js"; +import { NFCDefinition } from "./definitions.js"; /** * A simplified API for common NFC reading operations @@ -94,4 +95,12 @@ export class SimpleNfc { }, }); } + + /** + * Read a simple NFC tag + */ + read(): NFCDefinition { + // Dummy implementation + return { id: "2", data: "simple data" }; + } } diff --git a/utils.ts b/utils.ts index 768ca90..b7f632e 100644 --- a/utils.ts +++ b/utils.ts @@ -1,5 +1,5 @@ // src/utils.ts -import { NdefRecord, NdefMessage, NfcTnf, NfcRtd } from "./definitions"; +import { NdefRecord, NdefMessage, NfcTnf, NfcRtd } from "./definitions.js"; export class NfcUtils { /** @@ -98,3 +98,8 @@ export class NfcUtils { return false; } } + +export function formatData(data: string): string { + // Implement your utility function here + return data.trim(); +} diff --git a/web.ts b/web.ts index b38f584..e37d094 100644 --- a/web.ts +++ b/web.ts @@ -7,7 +7,7 @@ import { PluginListenerHandle, TagDetectedEvent, NdefRecord, -} from "./definitions"; +} from "./definitions.js"; export class WebNfc implements NfcPlugin { private scanSessionActive = false; @@ -369,3 +369,13 @@ export class WebNfc implements NfcPlugin { ); } } + +import { NFCDefinition } from "./definitions"; + +export class WebNFC { + // Implement your web NFC functionalities here + read(): NFCDefinition { + // Dummy implementation + return { id: "1", data: "sample data" }; + } +}