const url = require('url');
const Stash = require('../types/stash');
self.addEventListener('message', function (e) {
e.source.postMessage('[GUARDIAN]', 'Hello! Your message was: ' + e.data);
});
self.addEventListener('fetch', async function (event) {
const self = this;
console.log('[GUARDIAN]', 'request:', event);
const path = event.request.url;
const target = url.parse(path);
const uri = target.pathname;
const stash = new Stash();
console.log('stash:', stash);
console.log('target:', target);