@firebase/messaging-compat
Advanced tools
Comparing version 0.1.0-2021724205917 to 0.1.0-2021727231341
@@ -14,3 +14,3 @@ 'use strict'; | ||
var name = "@firebase/messaging-compat"; | ||
var version = "0.1.0-2021724205917"; | ||
var version = "0.1.0-2021727231341"; | ||
@@ -33,2 +33,37 @@ /** | ||
*/ | ||
function isSupported() { | ||
if (self && 'ServiceWorkerGlobalScope' in self) { | ||
// Running in ServiceWorker context | ||
return isSwSupported(); | ||
} | ||
else { | ||
// Assume we are in the window context. | ||
return isWindowSupported(); | ||
} | ||
} | ||
/** | ||
* Checks to see if the required APIs exist. | ||
*/ | ||
function isWindowSupported() { | ||
return ('indexedDB' in window && | ||
indexedDB !== null && | ||
navigator.cookieEnabled && | ||
'serviceWorker' in navigator && | ||
'PushManager' in window && | ||
'Notification' in window && | ||
'fetch' in window && | ||
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && | ||
PushSubscription.prototype.hasOwnProperty('getKey')); | ||
} | ||
/** | ||
* Checks to see if the required APIs exist within SW Context. | ||
*/ | ||
function isSwSupported() { | ||
return ('indexedDB' in self && | ||
indexedDB !== null && | ||
'PushManager' in self && | ||
'Notification' in self && | ||
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && | ||
PushSubscription.prototype.hasOwnProperty('getKey')); | ||
} | ||
var MessagingCompatImpl = /** @class */ (function () { | ||
@@ -90,4 +125,7 @@ function MessagingCompatImpl(app, _delegate) { | ||
}; | ||
var NAMESPACE_EXPORTS = { | ||
isSupported: isSupported | ||
}; | ||
function registerMessagingCompat() { | ||
firebase__default['default'].INTERNAL.registerComponent(new component.Component('messaging-compat', messagingCompatFactory, "PUBLIC" /* PUBLIC */)); | ||
firebase__default['default'].INTERNAL.registerComponent(new component.Component('messaging-compat', messagingCompatFactory, "PUBLIC" /* PUBLIC */).setServiceProps(NAMESPACE_EXPORTS)); | ||
} | ||
@@ -94,0 +132,0 @@ |
@@ -8,3 +8,3 @@ import firebase from '@firebase/app-compat'; | ||
var name = "@firebase/messaging-compat"; | ||
var version = "0.1.0-2021724205917"; | ||
var version = "0.1.0-2021727231341"; | ||
@@ -27,2 +27,37 @@ /** | ||
*/ | ||
function isSupported() { | ||
if (self && 'ServiceWorkerGlobalScope' in self) { | ||
// Running in ServiceWorker context | ||
return isSwSupported(); | ||
} | ||
else { | ||
// Assume we are in the window context. | ||
return isWindowSupported(); | ||
} | ||
} | ||
/** | ||
* Checks to see if the required APIs exist. | ||
*/ | ||
function isWindowSupported() { | ||
return ('indexedDB' in window && | ||
indexedDB !== null && | ||
navigator.cookieEnabled && | ||
'serviceWorker' in navigator && | ||
'PushManager' in window && | ||
'Notification' in window && | ||
'fetch' in window && | ||
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && | ||
PushSubscription.prototype.hasOwnProperty('getKey')); | ||
} | ||
/** | ||
* Checks to see if the required APIs exist within SW Context. | ||
*/ | ||
function isSwSupported() { | ||
return ('indexedDB' in self && | ||
indexedDB !== null && | ||
'PushManager' in self && | ||
'Notification' in self && | ||
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && | ||
PushSubscription.prototype.hasOwnProperty('getKey')); | ||
} | ||
var MessagingCompatImpl = /** @class */ (function () { | ||
@@ -84,4 +119,7 @@ function MessagingCompatImpl(app, _delegate) { | ||
}; | ||
var NAMESPACE_EXPORTS = { | ||
isSupported: isSupported | ||
}; | ||
function registerMessagingCompat() { | ||
firebase.INTERNAL.registerComponent(new Component('messaging-compat', messagingCompatFactory, "PUBLIC" /* PUBLIC */)); | ||
firebase.INTERNAL.registerComponent(new Component('messaging-compat', messagingCompatFactory, "PUBLIC" /* PUBLIC */).setServiceProps(NAMESPACE_EXPORTS)); | ||
} | ||
@@ -88,0 +126,0 @@ |
@@ -7,3 +7,3 @@ import firebase from '@firebase/app-compat'; | ||
const name = "@firebase/messaging-compat"; | ||
const version = "0.1.0-2021724205917"; | ||
const version = "0.1.0-2021727231341"; | ||
@@ -26,2 +26,37 @@ /** | ||
*/ | ||
function isSupported() { | ||
if (self && 'ServiceWorkerGlobalScope' in self) { | ||
// Running in ServiceWorker context | ||
return isSwSupported(); | ||
} | ||
else { | ||
// Assume we are in the window context. | ||
return isWindowSupported(); | ||
} | ||
} | ||
/** | ||
* Checks to see if the required APIs exist. | ||
*/ | ||
function isWindowSupported() { | ||
return ('indexedDB' in window && | ||
indexedDB !== null && | ||
navigator.cookieEnabled && | ||
'serviceWorker' in navigator && | ||
'PushManager' in window && | ||
'Notification' in window && | ||
'fetch' in window && | ||
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && | ||
PushSubscription.prototype.hasOwnProperty('getKey')); | ||
} | ||
/** | ||
* Checks to see if the required APIs exist within SW Context. | ||
*/ | ||
function isSwSupported() { | ||
return ('indexedDB' in self && | ||
indexedDB !== null && | ||
'PushManager' in self && | ||
'Notification' in self && | ||
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && | ||
PushSubscription.prototype.hasOwnProperty('getKey')); | ||
} | ||
class MessagingCompatImpl { | ||
@@ -74,4 +109,7 @@ constructor(app, _delegate) { | ||
}; | ||
const NAMESPACE_EXPORTS = { | ||
isSupported | ||
}; | ||
function registerMessagingCompat() { | ||
firebase.INTERNAL.registerComponent(new Component('messaging-compat', messagingCompatFactory, "PUBLIC" /* PUBLIC */)); | ||
firebase.INTERNAL.registerComponent(new Component('messaging-compat', messagingCompatFactory, "PUBLIC" /* PUBLIC */).setServiceProps(NAMESPACE_EXPORTS)); | ||
} | ||
@@ -78,0 +116,0 @@ |
@@ -34,5 +34,8 @@ /** | ||
import { FirebaseApp as FirebaseAppCompat } from "@firebase/app-compat"; | ||
import { Messaging } from "@firebase/messaging"; | ||
import { Messaging, GetTokenOptions, NextFn, MessagePayload, Observer, Unsubscribe } from "@firebase/messaging"; | ||
declare module "@firebase/messaging" { | ||
function deleteToken(messaging: MessagingCompat): Promise<boolean>; | ||
function getMessaging(app?: FirebaseAppCompat): Messaging; | ||
function getToken(messaging: MessagingCompat, options?: GetTokenOptions): Promise<string>; | ||
function onMessage(messaging: MessagingCompat, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe; | ||
} |
{ | ||
"name": "@firebase/messaging-compat", | ||
"version": "0.1.0-2021724205917", | ||
"version": "0.1.0-2021727231341", | ||
"license": "Apache-2.0", | ||
@@ -27,9 +27,9 @@ "description": "", | ||
"type-check": "tsc --noEmit", | ||
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../messaging/dist/index-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/dist/index-public.d.ts -o dist/src/index.d.ts -a -r Messaging:MessagingCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/messaging" | ||
}, | ||
"peerDependencies": { | ||
"@firebase/app-compat": "0.1.0-2021724205917" | ||
"@firebase/app-compat": "0.1.1-2021727231341" | ||
}, | ||
"dependencies": { | ||
"@firebase/messaging": "0.9.0-2021724205917", | ||
"@firebase/messaging": "0.9.0", | ||
"@firebase/component": "0.5.6", | ||
@@ -40,3 +40,3 @@ "@firebase/util": "1.3.0", | ||
"devDependencies": { | ||
"@firebase/app-compat": "0.1.0-2021724205917", | ||
"@firebase/app-compat": "0.1.1-2021727231341", | ||
"@rollup/plugin-json": "4.1.0", | ||
@@ -43,0 +43,0 @@ "rollup-plugin-typescript2": "0.30.0", |
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
50127
14
547
+ Added@firebase/app@0.7.0(transitive)
+ Added@firebase/app-compat@0.1.1-2021727231341(transitive)
+ Added@firebase/installations@0.5.0(transitive)
+ Added@firebase/messaging@0.9.0(transitive)
+ Added@firebase/messaging-interop-types@0.1.0(transitive)
- Removed@firebase/app@0.7.0-2021724205917(transitive)
- Removed@firebase/app-compat@0.1.0-2021724205917(transitive)
- Removed@firebase/installations@0.5.0-2021724205917(transitive)
- Removed@firebase/messaging@0.9.0-2021724205917(transitive)
- Removed@firebase/messaging-interop-types@0.1.0-2021724205917(transitive)
Updated@firebase/messaging@0.9.0