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

service-worker-mock

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

service-worker-mock - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

20

index.js

@@ -27,6 +27,17 @@ const URL = require('dom-urls');

const makeListenersWithReset = () => {
const listeners = {};
Object.defineProperty(listeners, 'reset', {
enumerable: false,
value: () => {
self.listeners = makeListenersWithReset();
}
});
return listeners;
};
class ServiceWorkerGlobalScope {
constructor(envOptions) {
const options = defaults(envOptions);
this.listeners = {};
this.listeners = makeListenersWithReset();
this.location = new URL(options.locationUrl, options.locationBase);

@@ -82,2 +93,9 @@ this.skipWaiting = () => Promise.resolve();

// Allow resetting without rewriting
this.resetSwEnv = () => {
this.caches.reset();
this.clients.reset();
this.listeners.reset();
};
this.self = this;

@@ -84,0 +102,0 @@ }

@@ -71,4 +71,8 @@ // https://developer.mozilla.org/en-US/docs/Web/API/Cache

}
reset() {
this.store = new Map();
}
}
module.exports = Cache;

@@ -50,4 +50,8 @@ const Cache = require('./Cache');

}
reset() {
this.caches = {};
}
}
module.exports = CacheStorage;

@@ -32,4 +32,7 @@ const Client = require('./Client');

reset() {
this.clients = [];
}
}
module.exports = Clients;

7

package.json
{
"name": "service-worker-mock",
"version": "1.6.0",
"version": "1.7.0",
"main": "index.js",

@@ -23,3 +23,6 @@ "repository": {

"author": "zackargyle",
"license": "MIT"
"license": "MIT",
"dependencies": {
"dom-urls": "^1.1.0"
}
}
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