Skip to content

Commit 7aeb80b

Browse files
authored
feat(core): Enable keepalive for fetch requests (#1120)
Add the [`keepalive`](https://developer.mozilla.org/en-US/docs/Web/API/Request/keepalive) so that, when used in web contexts, incomplete requests don't get cancelled if the page unloads before the request completes.
1 parent 817b4f1 commit 7aeb80b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/core/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const uploadEvents = async ({
1111
}) => {
1212
return await fetch(url, {
1313
method: 'POST',
14+
keepalive: true,
1415
body: JSON.stringify({
1516
batch: events,
1617
sentAt: new Date().toISOString(),

0 commit comments

Comments
 (0)