Open inexorabletash opened 9 years ago
In email to public-webapps, @domenic suggests returning tx.complete as a convenience.
As hinted at in #9 it may be convenient to make it a pass-through so you can write e.g.
const url = await tx.objectStore('urls').get(key);
const request = await tx.waitUntil(fetch(url));
const text = await tx.waitUntil(request.text());
tx.objectStore('bodies').put(text, key);
.... which looks better than the "IIAFE" alternative:
tx.waitUntil((async () => {
const url = await tx.objectStore('urls').get(key);
const request = await fetch(url);
const text = await request.text();
await tx.objectStore('bodies').put(text, key);
})());
Options include:
1 is redundant with
.complete
2 is not terribly helpful 3 is what ExtendableEvent is defined asSo 3 probably makes the most sense and leaves room to change it in the future.