Skip to content

Commit c8547bc

Browse files
committed
Add navigator.nfc and navigator.nfc.ndef objects
Signed-off-by: Zoltan Kis <[email protected]>
1 parent dbb9a52 commit c8547bc

File tree

3 files changed

+175
-146
lines changed

3 files changed

+175
-146
lines changed

EXPLAINER.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ when required, about granting access to Web NFC. It means sending and receiving
9292
info when users tap NFC devices can be done smoothly once permission is granted.
9393

9494
```js
95-
const reader = new NDEFReader();
95+
const reader = navigator.nfc.ndef;
9696

9797
async function startScanning() {
9898
await reader.scan();
@@ -126,7 +126,7 @@ cases where the text might even be in UTF-16 do to existing real life
126126
implementations.
127127

128128
```js
129-
const reader = new NDEFReader();
129+
const reader = navigator.nfc.ndef;
130130

131131
await reader.scan({ recordType: "example.com:smart-poster" });
132132
reader.onreading = event => {
@@ -163,7 +163,7 @@ abortController.signal.onabort = event => {
163163
// All NFC operations have been aborted.
164164
};
165165

166-
const ndef = new NDEFReader();
166+
const reader = navigator.nfc.ndef;
167167
await ndef.scan({ signal: abortController.signal });
168168

169169
await ndef.push("foo", { signal: abortController.signal });

0 commit comments

Comments
 (0)