updated imports
This commit is contained in:
parent
b190722a4e
commit
46676e84c2
@ -236,3 +236,9 @@ export interface NfcError extends Error {
|
|||||||
message: string;
|
message: string;
|
||||||
detail?: any;
|
detail?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface NFCDefinition {
|
||||||
|
// Define your NFC interface here
|
||||||
|
id: string;
|
||||||
|
data: string;
|
||||||
|
}
|
||||||
|
10
index.ts
10
index.ts
@ -1,5 +1,5 @@
|
|||||||
export * from "./definitions";
|
export * from "./definitions.js";
|
||||||
export * from "./web";
|
export * from "./web.js";
|
||||||
export * from "./nfc";
|
export * from "./nfc.js";
|
||||||
export * from "./utils";
|
export * from "./utils.js";
|
||||||
export * from "./simple-nfc";
|
export * from "./simple-nfc.js";
|
||||||
|
4
nfc.ts
4
nfc.ts
@ -8,8 +8,8 @@ import {
|
|||||||
ShareOptions,
|
ShareOptions,
|
||||||
PluginListenerHandle,
|
PluginListenerHandle,
|
||||||
NfcErrorType,
|
NfcErrorType,
|
||||||
} from "./definitions";
|
} from "./definitions.js";
|
||||||
import { WebNfc } from "./web";
|
import { WebNfc } from "./web.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main NFC class that provides access to NFC functionality.
|
* Main NFC class that provides access to NFC functionality.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Nfc } from "./nfc";
|
import { Nfc } from "./nfc.js";
|
||||||
import { NfcUtils } from "./utils";
|
import { NfcUtils } from "./utils.js";
|
||||||
|
import { NFCDefinition } from "./definitions.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simplified API for common NFC reading operations
|
* 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" };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
7
utils.ts
7
utils.ts
@ -1,5 +1,5 @@
|
|||||||
// src/utils.ts
|
// src/utils.ts
|
||||||
import { NdefRecord, NdefMessage, NfcTnf, NfcRtd } from "./definitions";
|
import { NdefRecord, NdefMessage, NfcTnf, NfcRtd } from "./definitions.js";
|
||||||
|
|
||||||
export class NfcUtils {
|
export class NfcUtils {
|
||||||
/**
|
/**
|
||||||
@ -98,3 +98,8 @@ export class NfcUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function formatData(data: string): string {
|
||||||
|
// Implement your utility function here
|
||||||
|
return data.trim();
|
||||||
|
}
|
||||||
|
12
web.ts
12
web.ts
@ -7,7 +7,7 @@ import {
|
|||||||
PluginListenerHandle,
|
PluginListenerHandle,
|
||||||
TagDetectedEvent,
|
TagDetectedEvent,
|
||||||
NdefRecord,
|
NdefRecord,
|
||||||
} from "./definitions";
|
} from "./definitions.js";
|
||||||
|
|
||||||
export class WebNfc implements NfcPlugin {
|
export class WebNfc implements NfcPlugin {
|
||||||
private scanSessionActive = false;
|
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" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user