Skip to content

Commit

Permalink
writting
Browse files Browse the repository at this point in the history
  • Loading branch information
Patricio Vargas committed Aug 10, 2021
1 parent a282a00 commit df092a5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/containers/Write.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
import React from 'react';

const Write = () => {

const onWrite = async() => {
const abortController = new AbortController();
abortController.signal.onabort = event => {
alert('STOP');
};
try {
const ndef = new window.NDEFReader();
await ndef.write(
{
records: [{ recordType: "text", data: "17" }]
},
{signal: abortController.signal}
);
alert(`${16} saved!`);
abortController.abort();
} catch (error) {
console.log(error);
abortController.abort();
}
};

onWrite();
return (
"Write"
);
Expand Down

0 comments on commit df092a5

Please sign in to comment.