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

@firebase/messaging

Package Overview
Dependencies
Maintainers
4
Versions
3322
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firebase/messaging - npm Package Compare versions

Comparing version 0.12.14-20241112154924 to 0.12.14-canary.1294e64c8

37

dist/esm/index.esm2017.js

@@ -32,2 +32,3 @@ import '@firebase/installations';

const CONSOLE_CAMPAIGN_ANALYTICS_ENABLED = 'google.c.a.e';
const DEFAULT_REGISTRATION_TIMEOUT = 10000;
var MessageType$1;

@@ -827,2 +828,3 @@ (function (MessageType) {

});
await waitForRegistrationActive(messaging.swRegistration);
}

@@ -835,2 +837,35 @@ catch (e) {

}
/**
* Waits for registration to become active. MDN documentation claims that
* a service worker registration should be ready to use after awaiting
* navigator.serviceWorker.register() but that doesn't seem to be the case in
* practice, causing the SDK to throw errors when calling
* swRegistration.pushManager.subscribe() too soon after register(). The only
* solution seems to be waiting for the service worker registration `state`
* to become "active".
*/
async function waitForRegistrationActive(registration) {
return new Promise((resolve, reject) => {
const rejectTimeout = setTimeout(() => reject(new Error(`Service worker not registered after ${DEFAULT_REGISTRATION_TIMEOUT} ms`)), DEFAULT_REGISTRATION_TIMEOUT);
const incomingSw = registration.installing || registration.waiting;
if (registration.active) {
clearTimeout(rejectTimeout);
resolve();
}
else if (incomingSw) {
incomingSw.onstatechange = ev => {
var _a;
if (((_a = ev.target) === null || _a === void 0 ? void 0 : _a.state) === 'activated') {
incomingSw.onstatechange = null;
clearTimeout(rejectTimeout);
resolve();
}
};
}
else {
clearTimeout(rejectTimeout);
reject(new Error('No incoming service worker found.'));
}
});
}

@@ -1000,3 +1035,3 @@ /**

const name = "@firebase/messaging";
const version = "0.12.14-20241112154924";
const version = "0.12.14-canary.1294e64c8";

@@ -1003,0 +1038,0 @@ /**

@@ -33,2 +33,3 @@ /**

export declare const DEFAULT_BACKOFF_TIME_MS = 5000;
export declare const DEFAULT_REGISTRATION_TIMEOUT = 10000;
export declare const FCM_LOG_SOURCE = 1249;

@@ -35,0 +36,0 @@ export declare const SDK_PLATFORM_WEB = 3;

@@ -36,2 +36,3 @@ 'use strict';

const CONSOLE_CAMPAIGN_ANALYTICS_ENABLED = 'google.c.a.e';
const DEFAULT_REGISTRATION_TIMEOUT = 10000;
var MessageType$1;

@@ -831,2 +832,3 @@ (function (MessageType) {

});
await waitForRegistrationActive(messaging.swRegistration);
}

@@ -839,2 +841,35 @@ catch (e) {

}
/**
* Waits for registration to become active. MDN documentation claims that
* a service worker registration should be ready to use after awaiting
* navigator.serviceWorker.register() but that doesn't seem to be the case in
* practice, causing the SDK to throw errors when calling
* swRegistration.pushManager.subscribe() too soon after register(). The only
* solution seems to be waiting for the service worker registration `state`
* to become "active".
*/
async function waitForRegistrationActive(registration) {
return new Promise((resolve, reject) => {
const rejectTimeout = setTimeout(() => reject(new Error(`Service worker not registered after ${DEFAULT_REGISTRATION_TIMEOUT} ms`)), DEFAULT_REGISTRATION_TIMEOUT);
const incomingSw = registration.installing || registration.waiting;
if (registration.active) {
clearTimeout(rejectTimeout);
resolve();
}
else if (incomingSw) {
incomingSw.onstatechange = ev => {
var _a;
if (((_a = ev.target) === null || _a === void 0 ? void 0 : _a.state) === 'activated') {
incomingSw.onstatechange = null;
clearTimeout(rejectTimeout);
resolve();
}
};
}
else {
clearTimeout(rejectTimeout);
reject(new Error('No incoming service worker found.'));
}
});
}

@@ -1004,3 +1039,3 @@ /**

const name = "@firebase/messaging";
const version = "0.12.14-20241112154924";
const version = "0.12.14-canary.1294e64c8";

@@ -1007,0 +1042,0 @@ /**

@@ -33,2 +33,3 @@ /**

export declare const DEFAULT_BACKOFF_TIME_MS = 5000;
export declare const DEFAULT_REGISTRATION_TIMEOUT = 10000;
export declare const FCM_LOG_SOURCE = 1249;

@@ -35,0 +36,0 @@ export declare const SDK_PLATFORM_WEB = 3;

14

package.json
{
"name": "@firebase/messaging",
"version": "0.12.14-20241112154924",
"version": "0.12.14-canary.1294e64c8",
"description": "",

@@ -52,9 +52,9 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",

"peerDependencies": {
"@firebase/app": "0.10.16-20241112154924"
"@firebase/app": "0.10.16-canary.1294e64c8"
},
"dependencies": {
"@firebase/installations": "0.6.11-20241112154924",
"@firebase/messaging-interop-types": "0.2.3-20241112154924",
"@firebase/util": "1.10.2-20241112154924",
"@firebase/component": "0.6.11-20241112154924",
"@firebase/installations": "0.6.11-canary.1294e64c8",
"@firebase/messaging-interop-types": "0.2.3-canary.1294e64c8",
"@firebase/util": "1.10.2-canary.1294e64c8",
"@firebase/component": "0.6.11-canary.1294e64c8",
"idb": "7.1.1",

@@ -64,3 +64,3 @@ "tslib": "^2.1.0"

"devDependencies": {
"@firebase/app": "0.10.16-20241112154924",
"@firebase/app": "0.10.16-canary.1294e64c8",
"rollup": "2.79.1",

@@ -67,0 +67,0 @@ "rollup-plugin-typescript2": "0.31.2",

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

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