workbox-google-analytics
Advanced tools
Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6
@@ -6,3 +6,3 @@ this.workbox = this.workbox || {}; | ||
try { | ||
self.workbox.v['workbox:google-analytics:3.0.0-alpha.5'] = 1; | ||
self.workbox.v['workbox:google-analytics:3.0.0-alpha.6'] = 1; | ||
} catch (e) {} // eslint-disable-line | ||
@@ -62,11 +62,24 @@ | ||
*/ | ||
const getTextFromBlob = blob => { | ||
return new Promise((resolve, reject) => { | ||
const reader = new FileReader(); | ||
reader.onloadend = () => resolve(reader.result); | ||
reader.onerror = () => reject(reader.error); | ||
reader.readAsText(blob); | ||
const getTextFromBlob = (() => { | ||
var _ref = babelHelpers.asyncToGenerator(function* (blob) { | ||
// This usage of `return await new Promise...` is intentional to work around | ||
// a bug in the transpiled/minified output. | ||
// See https://github.com/GoogleChrome/workbox/issues/1186 | ||
return yield new Promise(function (resolve, reject) { | ||
const reader = new FileReader(); | ||
reader.onloadend = function () { | ||
return resolve(reader.result); | ||
}; | ||
reader.onerror = function () { | ||
return reject(reader.error); | ||
}; | ||
reader.readAsText(blob); | ||
}); | ||
}); | ||
}; | ||
return function getTextFromBlob(_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
})(); | ||
/** | ||
@@ -85,3 +98,3 @@ * Creates the requestWillDequeue callback to be used with the background | ||
return (() => { | ||
var _ref = babelHelpers.asyncToGenerator(function* ({ url, timestamp, requestInit }) { | ||
var _ref2 = babelHelpers.asyncToGenerator(function* ({ url, timestamp, requestInit }) { | ||
url = new URL(url); | ||
@@ -124,4 +137,4 @@ | ||
return function (_x) { | ||
return _ref.apply(this, arguments); | ||
return function (_x2) { | ||
return _ref2.apply(this, arguments); | ||
}; | ||
@@ -128,0 +141,0 @@ })(); |
@@ -1,3 +0,3 @@ | ||
this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,t,n,o,r,c,s){"use strict";try{self.workbox.v["workbox:google-analytics:3.0.0-alpha.5"]=1}catch(e){}const a="www.google-analytics.com",l=/^\/(\w+\/)?collect/,w=e=>(()=>{var t=babelHelpers.asyncToGenerator(function*({url:t,timestamp:n,requestInit:o}){t=new URL(t);let r;if(o.body){const e=yield c=o.body,new Promise((e,t)=>{const n=new FileReader;n.onloadend=(()=>e(n.result)),n.onerror=(()=>t(n.error)),n.readAsText(c)});r=new URLSearchParams(e)}else r=t.searchParams;var c;const s=Date.now()-n;if(r.set("qt",s),e.parameterOverrides)for(const t of Object.keys(e.parameterOverrides)){const n=e.parameterOverrides[t];r.set(t,n)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,r),o.body=r.toString(),o.method="POST",o.mode="cors",o.credentials="omit",o.headers='[["Content-Type", "text/plain"]]',o.url=`${t.origin}${t.pathname}`});return function(e){return t.apply(this,arguments)}})();return e.initialize=((e={})=>{const i=n.cacheNames.getGoogleAnalyticsName(e.cacheName),u=new t.Plugin("workbox-google-analytics",{maxRetentionTime:1728e5,callbacks:{requestWillReplay:w(e)}}),f=[(e=>{const t=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>e.hostname===a&&"/analytics.js"===e.pathname,t,"GET")})(i),(e=>{const t=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,t,"GET")})(i),...(e=>{const t=({url:e})=>e.hostname===a&&l.test(e.pathname),n=new s.NetworkOnly({plugins:[e]});return[new o.Route(t,n,"GET"),new o.Route(t,n,"POST")]})(u)],m=new r.Router;for(const e of f)m.registerRoute(e);self.addEventListener("fetch",e=>{const t=m.handleRequest(e);t&&e.respondWith(t)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies); | ||
this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){"use strict";try{self.workbox.v["workbox:google-analytics:3.0.0-alpha.6"]=1}catch(e){}const i="www.google-analytics.com",l=/^\/(\w+\/)?collect/,a=(()=>{var e=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})});return function(n){return e.apply(this,arguments)}})(),u=e=>(()=>{var n=babelHelpers.asyncToGenerator(function*({url:n,timestamp:t,requestInit:o}){n=new URL(n);let r;if(o.body){const e=yield a(o.body);r=new URLSearchParams(e)}else r=n.searchParams;const c=Date.now()-t;if(r.set("qt",c),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const t=e.parameterOverrides[n];r.set(n,t)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,r),o.body=r.toString(),o.method="POST",o.mode="cors",o.credentials="omit",o.headers='[["Content-Type", "text/plain"]]',o.url=`${n.origin}${n.pathname}`});return function(e){return n.apply(this,arguments)}})();return e.initialize=((e={})=>{const a=t.cacheNames.getGoogleAnalyticsName(e.cacheName),w=new n.Plugin("workbox-google-analytics",{maxRetentionTime:1728e5,callbacks:{requestWillReplay:u(e)}}),f=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>e.hostname===i&&"/analytics.js"===e.pathname,n,"GET")})(a),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,n,"GET")})(a),...(e=>{const n=({url:e})=>e.hostname===i&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,"GET"),new o.Route(n,t,"POST")]})(w)],b=new r.Router;for(const e of f)b.registerRoute(e);self.addEventListener("fetch",e=>{const n=b.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies); | ||
//# sourceMappingURL=workbox-google-analytics.prod.js.map |
{ | ||
"name": "workbox-google-analytics", | ||
"version": "3.0.0-alpha.5", | ||
"version": "3.0.0-alpha.6", | ||
"license": "Apache-2.0", | ||
@@ -31,7 +31,7 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-background-sync": "^3.0.0-alpha.5", | ||
"workbox-core": "^3.0.0-alpha.5", | ||
"workbox-routing": "^3.0.0-alpha.5", | ||
"workbox-strategies": "^3.0.0-alpha.5" | ||
"workbox-background-sync": "^3.0.0-alpha.6", | ||
"workbox-core": "^3.0.0-alpha.6", | ||
"workbox-routing": "^3.0.0-alpha.6", | ||
"workbox-strategies": "^3.0.0-alpha.6" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43357
11
457