@firebase/messaging-compat
Advanced tools
Comparing version 0.0.900-exp.520ca39d0 to 0.0.900-exp.57f19127c
@@ -7,2 +7,3 @@ 'use strict'; | ||
var messaging = require('@firebase/messaging'); | ||
var sw = require('@firebase/messaging/sw'); | ||
@@ -14,3 +15,3 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var name = "@firebase/messaging-compat"; | ||
var version = "0.0.900-exp.520ca39d0"; | ||
var version = "0.0.900-exp.57f19127c"; | ||
@@ -37,4 +38,2 @@ /** | ||
this._delegate = _delegate; | ||
this.onBackgroundMessageHandler = null; | ||
this.onMessageHandler = null; | ||
this.app = app; | ||
@@ -61,3 +60,3 @@ this._delegate = _delegate; | ||
MessagingCompatImpl.prototype.onBackgroundMessage = function (nextOrObserver) { | ||
return messaging.onBackgroundMessage(this._delegate, nextOrObserver); | ||
return sw.onBackgroundMessage(this._delegate, nextOrObserver); | ||
}; | ||
@@ -84,3 +83,10 @@ return MessagingCompatImpl; | ||
var messagingCompatFactory = function (container) { | ||
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-exp').getImmediate()); | ||
if (!!navigator) { | ||
// in window | ||
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-exp').getImmediate()); | ||
} | ||
else { | ||
// in sw | ||
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-sw-exp').getImmediate()); | ||
} | ||
}; | ||
@@ -87,0 +93,0 @@ function registerMessagingCompat() { |
import firebase from '@firebase/app-compat'; | ||
import { Component } from '@firebase/component'; | ||
import { __awaiter, __generator } from 'tslib'; | ||
import { getToken, deleteToken, onMessage, onBackgroundMessage } from '@firebase/messaging'; | ||
import { getToken, deleteToken, onMessage } from '@firebase/messaging'; | ||
import { onBackgroundMessage } from '@firebase/messaging/sw'; | ||
var name = "@firebase/messaging-compat"; | ||
var version = "0.0.900-exp.520ca39d0"; | ||
var version = "0.0.900-exp.57f19127c"; | ||
@@ -29,4 +30,2 @@ /** | ||
this._delegate = _delegate; | ||
this.onBackgroundMessageHandler = null; | ||
this.onMessageHandler = null; | ||
this.app = app; | ||
@@ -75,3 +74,10 @@ this._delegate = _delegate; | ||
var messagingCompatFactory = function (container) { | ||
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-exp').getImmediate()); | ||
if (!!navigator) { | ||
// in window | ||
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-exp').getImmediate()); | ||
} | ||
else { | ||
// in sw | ||
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-sw-exp').getImmediate()); | ||
} | ||
}; | ||
@@ -78,0 +84,0 @@ function registerMessagingCompat() { |
import firebase from '@firebase/app-compat'; | ||
import { Component } from '@firebase/component'; | ||
import { getToken, deleteToken, onMessage, onBackgroundMessage } from '@firebase/messaging'; | ||
import { getToken, deleteToken, onMessage } from '@firebase/messaging'; | ||
import { onBackgroundMessage } from '@firebase/messaging/sw'; | ||
const name = "@firebase/messaging-compat"; | ||
const version = "0.0.900-exp.520ca39d0"; | ||
const version = "0.0.900-exp.57f19127c"; | ||
@@ -28,4 +29,2 @@ /** | ||
this._delegate = _delegate; | ||
this.onBackgroundMessageHandler = null; | ||
this.onMessageHandler = null; | ||
this.app = app; | ||
@@ -65,3 +64,10 @@ this._delegate = _delegate; | ||
const messagingCompatFactory = (container) => { | ||
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-exp').getImmediate()); | ||
if (!!navigator) { | ||
// in window | ||
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-exp').getImmediate()); | ||
} | ||
else { | ||
// in sw | ||
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-sw-exp').getImmediate()); | ||
} | ||
}; | ||
@@ -68,0 +74,0 @@ function registerMessagingCompat() { |
@@ -34,11 +34,8 @@ /** | ||
import { FirebaseApp as FirebaseAppCompat } from "@firebase/app-compat"; | ||
import { FirebaseMessaging, NextFn, MessagePayload, Observer, Unsubscribe } from "@firebase/messaging"; | ||
import { FirebaseMessaging, GetTokenOptions, NextFn, MessagePayload, Observer, Unsubscribe } from "@firebase/messaging"; | ||
declare module "@firebase/messaging" { | ||
function deleteToken(messaging: MessagingCompat): Promise<boolean>; | ||
function getMessaging(app?: FirebaseAppCompat): FirebaseMessaging; | ||
function getToken(messaging: MessagingCompat, options?: { | ||
vapidKey?: string; | ||
swReg?: ServiceWorkerRegistration; | ||
}): Promise<string>; | ||
function getToken(messaging: MessagingCompat, options?: GetTokenOptions): Promise<string>; | ||
function onMessage(messaging: MessagingCompat, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe; | ||
} |
@@ -29,9 +29,6 @@ /** | ||
} | ||
export declare function isSupported(): boolean; | ||
export declare class MessagingCompatImpl implements MessagingCompat, _FirebaseService { | ||
readonly app: AppCompat; | ||
readonly _delegate: FirebaseMessaging; | ||
swRegistration?: ServiceWorkerRegistration; | ||
vapidKey?: string; | ||
onBackgroundMessageHandler: NextFn<MessagePayload> | Observer<MessagePayload> | null; | ||
onMessageHandler: NextFn<MessagePayload> | Observer<MessagePayload> | null; | ||
constructor(app: AppCompat, _delegate: FirebaseMessaging); | ||
@@ -38,0 +35,0 @@ getToken(options?: { |
{ | ||
"name": "@firebase/messaging-compat", | ||
"version": "0.0.900-exp.520ca39d0", | ||
"version": "0.0.900-exp.57f19127c", | ||
"license": "Apache-2.0", | ||
@@ -9,4 +9,4 @@ "description": "", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"esm2017": "dist/index.esm2017.js", | ||
"browser": "dist/index.esm2017.js", | ||
"module": "dist/index.esm2017.js", | ||
"typings": "dist/src/index.d.ts", | ||
@@ -29,12 +29,12 @@ "sw": "dist/index.sw.esm2017.js", | ||
"type-check": "tsc --noEmit", | ||
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../messaging-exp/dist/messaging-exp-public.d.ts -o dist/src/index.d.ts -a -r FirebaseMessaging:MessagingCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/messaging" | ||
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../messaging-exp/dist/index-public.d.ts -o dist/src/index.d.ts -a -r FirebaseMessaging:MessagingCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/messaging" | ||
}, | ||
"peerDependencies": { | ||
"@firebase/app-compat": "0.0.900-exp.520ca39d0" | ||
"@firebase/app-compat": "0.0.900-exp.57f19127c" | ||
}, | ||
"dependencies": { | ||
"@firebase/messaging": "0.0.900-exp.520ca39d0", | ||
"@firebase/component": "0.4.0", | ||
"@firebase/installations": "0.0.900-exp.520ca39d0", | ||
"@firebase/util": "0.4.1", | ||
"@firebase/messaging": "0.0.900-exp.57f19127c", | ||
"@firebase/component": "0.5.3", | ||
"@firebase/installations": "0.0.900-exp.57f19127c", | ||
"@firebase/util": "1.1.0", | ||
"tslib": "^2.1.0" | ||
@@ -56,3 +56,4 @@ }, | ||
"url": "https://github.com/firebase/firebase-js-sdk/issues" | ||
} | ||
}, | ||
"esm5": "dist/index.esm.js" | ||
} |
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
43516
433
+ Added@firebase/app@0.0.900-exp.57f19127c(transitive)
+ Added@firebase/app-compat@0.0.900-exp.57f19127c(transitive)
+ Added@firebase/component@0.5.3(transitive)
+ Added@firebase/installations@0.0.900-exp.57f19127c(transitive)
+ Added@firebase/messaging@0.0.900-exp.57f19127c(transitive)
+ Added@firebase/util@1.1.0(transitive)
- Removed@firebase/app@0.0.900-exp.520ca39d0(transitive)
- Removed@firebase/app-compat@0.0.900-exp.520ca39d0(transitive)
- Removed@firebase/component@0.4.0(transitive)
- Removed@firebase/installations@0.0.900-exp.520ca39d0(transitive)
- Removed@firebase/messaging@0.0.900-exp.520ca39d0(transitive)
- Removed@firebase/util@0.4.1(transitive)
Updated@firebase/component@0.5.3
Updated@firebase/util@1.1.0