Re: [web-nfc] Use addEventListener instead of watch

I think it is better extending. Creating something that looks similar but has edge cases that works differently isn't really good.

Other option would be (feel free to bikeshed names)

```js
const filter = navigator.nfc.createFilter({
  url: document.baseURI,
  recordType: "json"
});

filter.addEventListener('exchange', message => {
  for (let record of message.records) {
    let article =/[aeio]/.test(record.data.title) ? "an" : "a";
    console.log(`${record.data.name} is ${article} ${record.data.title}`);
  }
},{
  once: true
});

filter.startNotifications();
```

-- 
GitHub Notification of comment by kenchris
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/152#issuecomment-425045567 using your GitHub account

Received on Thursday, 27 September 2018 10:48:44 UTC