Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

navigator.sendbeacon

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

navigator.sendbeacon - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

package.json
{
"name": "navigator.sendbeacon",
"version": "0.0.4",
"version": "0.0.5",
"description": "Polyfill for navigator.sendBeacon()",

@@ -5,0 +5,0 @@ "main": "sendbeacon.js",

@@ -13,6 +13,2 @@ # Navigator.sendBeacon polyfill

```bash
bower install navigator-sendbeacon
```
# Usage

@@ -19,0 +15,0 @@

(function(root) {
'use strict';
function sendBeacon(url, data) {
function sendBeacon(url, data, _settings) {
var xhr = ('XMLHttpRequest' in window) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');

@@ -17,2 +17,15 @@ xhr.open('POST', url, false);

}
if (typeof _settings === 'object') {
if (!isNaN(_settings.timeout)) {
// xhr.timeout doesn't work for synchronous requests
setTimeout(function() {
if (xhr.readyState !== 4) {
xhr.abort();
}
}, _settings.timeout);
;
}
}
xhr.send(data);

@@ -19,0 +32,0 @@ return true;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc