function sendPulse() {
  const url = PULSE_API_ENDPOINT;

  // In case the beacon fails to queue, use HTTPRequest
  // TODO(abhinav): What about when the request itself fails?
  if (!navigator.sendBeacon(url)) {
    sendHTTPPulse();
  }
}
// Use the Beacon API to POST (fire and forget)
Use the Beacon API to POST (fire and forget)
Use the Beacon API to POST ( fire and forget )
function sendPulse() {
  const url = PULSE_API_ENDPOINT;
  if (!navigator.sendBeacon(url)) {
    sendHTTPPulse();
  }
}
function sendPulse ( ) { const url = PULSE_API_ENDPOINT ; if ( ! navigator . sendBeacon ( url ) ) { sendHTTPPulse ( ) ; } }
Use the Beacon API to POST (fire and forget)
Use the Beacon API to POST ( fire and forget )
// In case the beacon fails to queue, use HTTPRequest // TODO(abhinav): What about when the request itself fails?