polyfill-service
Version:
A polyfill combinator
1 lines • 1.72 kB
JSON
{"aliases":[],"browsers":{"chrome":"<39","firefox":"<31","ie":"*","opera":"<26","safari":"*","android":"*","firefox_mob":"<31","ie_mob":"*","op_mob":"*","ios_saf":"*"},"dependencies":["XMLHttpRequest"],"docs":"https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon","spec":"https://w3c.github.io/beacon/#sec-sendBeacon-method","repo":"https://github.com/miguelmota/Navigator.sendBeacon","license":"MIT","baseDir":"navigator/sendBeacon","hasTests":false,"rawSource":"\n// navigator.sendBeacon\nif (!('navigator' in this)) this.navigator = {};\nthis.navigator.sendBeacon = function sendBeacon(url, data) {\n\tvar xhr = ('XMLHttpRequest' in window) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');\n\txhr.open('POST', url, false);\n\txhr.setRequestHeader('Accept', '*/*');\n\tif (typeof data === 'string') {\n\t\txhr.setRequestHeader('Content-Type', 'text/plain;charset=UTF-8');\n\t\txhr.responseType = 'text/plain';\n\t} else if (Object.prototype.toString.call(data) === '[object Blob]') {\n\t\tif (data.type) {\n\t\t\txhr.setRequestHeader('Content-Type', data.type);\n\t\t}\n\t}\n\txhr.send(data);\n\treturn true;\n};\n","minSource":"\"navigator\"in this||(this.navigator={}),this.navigator.sendBeacon=function(e,t){var n=\"XMLHttpRequest\"in window?new XMLHttpRequest:new ActiveXObject(\"Microsoft.XMLHTTP\");return n.open(\"POST\",e,!1),n.setRequestHeader(\"Accept\",\"*/*\"),\"string\"==typeof t?(n.setRequestHeader(\"Content-Type\",\"text/plain;charset=UTF-8\"),n.responseType=\"text/plain\"):\"[object Blob]\"===Object.prototype.toString.call(t)&&t.type&&n.setRequestHeader(\"Content-Type\",t.type),n.send(t),!0};","detectSource":"'navigator' in this && 'sendBeacon' in navigator"}