updated imports

This commit is contained in:
Mohamad 2025-03-04 20:23:13 +01:00
parent b190722a4e
commit 46676e84c2
6 changed files with 41 additions and 11 deletions

View File

@ -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;
}

View File

@ -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";

4
nfc.ts
View File

@ -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.

View File

@ -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" };
}
}

View File

@ -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();
}

12
web.ts
View File

@ -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" };
}
}