- From: Kenneth Rohde Christiansen via GitHub <sysbot+gh@w3.org>
- Date: Thu, 29 Aug 2019 11:04:16 +0000
- To: public-web-nfc@w3.org
kenchris has just created a new issue for https://github.com/w3c/web-nfc: == How to update a record? == Currently, we override all records when pushing data - which is a bit foolish. We do have the option to read the data being read just before the push, but as it is in a different callback, this is not easy to get right. Instead of letting the push method just take data, we could additionally allow it to take a function and would receive the current records and return the data. A bit like when people modify arrays. `let filtered = [12, 5, 8, 130, 44].filter(value => value > 10);` But a bit like this pseudo code ``` push(records => { if (records[0].recordType === "json") { let record = records[0]; record.shots += 1; return [record]; } return records; }) Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/315 using your GitHub account
Received on Thursday, 29 August 2019 11:04:18 UTC