Skip to content

Commit

Permalink
Merge branch 'master' into kk/apl-50/cwv-toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnaKapadia authored Aug 16, 2021
2 parents 198af26 + d19e6db commit 3990cc6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* v2.22.5
- Fixes an issue with Core Web Vital tracking not being able to be disabled.
- Fixes an issue where `navigator.sendBeacon` errors were not being handled gracefully.

* v2.22.4
- Upgrade the web-vitals vendor library to v2.1.0.
Expand Down
17 changes: 12 additions & 5 deletions src/raygun.rum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -916,15 +916,22 @@ var raygunRumFactory = function(window, $, Raygun) {

var stringifiedPayload = JSON.stringify(payload);

/**
/**
* Use the navigator.sendBeacon method instead of a XHR requests when transmitting data
* This occurs mostly when the document is about to be discarded or hidden as
* This occurs mostly when the document is about to be discarded or hidden as
* all inflight XHR requests either will be or can be canceled.
*/
*/
if (self.sendUsingNavigatorBeacon && navigator.sendBeacon) {
navigator.sendBeacon(url, stringifiedPayload);
try {
navigator.sendBeacon(url, stringifiedPayload);
} catch (e) {
log(e, {
url: url,
payload: stringifiedPayload
});
}
return;
}
}

makePostCorsRequest(url, stringifiedPayload, successCallback, errorCallback);
}
Expand Down

0 comments on commit 3990cc6

Please sign in to comment.