Skip to content

Commit d217064

Browse files
authored
Fix examples that were awaiting inside of plain functions (#432)
There were just a few examples that didn't have the `async` keyword in the appropriate places.
1 parent dd9f1f9 commit d217064

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

EXPLAINER.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ if (!file_ref) {
105105

106106
// Read the contents of the file.
107107
const file_reader = new FileReader();
108-
file_reader.onload = (event) => {
108+
file_reader.onload = async (event) => {
109109
// File contents will appear in event.target.result. See
110110
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onload for
111111
// more info.
@@ -170,7 +170,7 @@ if (file_ref) {
170170
let file_id = "123"; // Some logic to determine which file you'd like to open
171171
let transaction = db.transaction(["filerefs"], "readonly");
172172
let request = transaction.objectStore("filerefs").get(file_id);
173-
request.onsuccess = function(e) {
173+
request.onsuccess = async function(e) {
174174
let ref = e.result;
175175

176176
// Permissions for the handle may have expired while the handle was stored
@@ -197,7 +197,7 @@ The fact that handles are serializable also means you can `postMessage` them aro
197197

198198
```javascript
199199
// In a service worker:
200-
self.addEventListener('some-hypothetical-launch-event', e => {
200+
self.addEventListener('some-hypothetical-launch-event', async (e) => {
201201
// e.file is a FileSystemFileHandle representing the file this SW was launched with.
202202
let win = await clients.openWindow('bla.html');
203203
if (win)

0 commit comments

Comments
 (0)