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 2.0.3 to 2.0.4

2

models/MessagePort.js

@@ -38,3 +38,3 @@ const EventTarget = require('./EventTarget');

*/
postMessage(message /* , transfer?: Transferable[]*/) {
postMessage(message /* , transfer?: Transferable[] */) {
const event = new MessageEvent('message', {

@@ -41,0 +41,0 @@ data: message

@@ -5,5 +5,6 @@ const ExtendableEvent = require('./ExtendableEvent');

class NotificationEvent extends ExtendableEvent {
constructor(args) {
super();
this.notification = args;
constructor(type, init) {
super(type, init);
this.notification = init ? init.notification : null;
this.action = init ? init.action : null;
}

@@ -10,0 +11,0 @@ }

@@ -49,2 +49,19 @@ // stubs https://developer.mozilla.org/en-US/docs/Web/API/Response

/**
* Creates a new response with a different URL.
* @param url The URL that the new response is to originate from.
* @param status [Optional] An optional status code for the response (e.g., 302.)
* @returns {Response}
*/
static redirect(url, status = 302) {
// see https://fetch.spec.whatwg.org/#dom-response-redirect
if (![301, 302, 303, 307, 308].includes(status)) {
throw new RangeError('Invalid status code');
}
return new Response(null, {
status: status,
headers: { Location: new URL(url).href }
});
}
static error() {

@@ -51,0 +68,0 @@ const errorResponse = new Response(null, {

@@ -36,3 +36,3 @@ const PushManager = require('./PushManager');

};
return Promise.resolve(new NotificationEvent(notification));
return Promise.resolve(new NotificationEvent('notification', { notification }));
}

@@ -39,0 +39,0 @@

{
"name": "service-worker-mock",
"version": "2.0.3",
"version": "2.0.4",
"main": "index.js",

@@ -27,3 +27,3 @@ "repository": {

"dom-urls": "^1.1.0",
"shelving-mock-indexeddb": "github:philipwalton/shelving-mock-indexeddb#621b7a275568051846d20e3e557fa1101418b1d1",
"shelving-mock-indexeddb": "^1.1.0",
"url-search-params": "^0.10.0",

@@ -30,0 +30,0 @@ "w3c-hr-time": "^1.0.1"

@@ -13,3 +13,3 @@ const ExtendableEvent = require('../models/ExtendableEvent');

case 'notificationclose':
return new NotificationEvent(args);
return new NotificationEvent('notification', { notification: args });
case 'push':

@@ -16,0 +16,0 @@ return new PushEvent(args);

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