Variables
sandbox
const sandbox: {
deliver: Promise<DeliveryResult>;
registration: SimulatedServiceWorkerRegistration;
};
Type Declaration
deliver()
deliver(messaging: Messaging, spec: DeliverSpec): Promise<DeliveryResult>;
Same driver as the client entry — see pyric/messaging’s sandbox.deliver.
Parameters
| Parameter | Type |
|---|---|
messaging | Messaging |
spec | DeliverSpec |
Returns
Promise<DeliveryResult>
registration()
registration(): SimulatedServiceWorkerRegistration;
The module-default simulated service-worker registration.
Returns
SimulatedServiceWorkerRegistration
Functions
experimentalSetDeliveryMetricsExportedToBigQueryEnabled()
function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging: Messaging, enable: boolean): void;
Toggle delivery-metrics export to BigQuery at runtime; default off. The sandbox records the flag (observable via repeated calls) but exports nothing — there is no BigQuery plane to export to.
Parameters
| Parameter | Type |
|---|---|
messaging | Messaging |
enable | boolean |
Returns
void
getMessaging()
function getMessaging(app?: FirebaseApp): Messaging;
Return the FCM Messaging instance for the given (or default) app —
service-worker plane (upstream: getMessagingInSw, component name
messaging-sw).
Parameters
| Parameter | Type |
|---|---|
app? | FirebaseApp |
Returns
isSupported()
function isSupported(): Promise<boolean>;
Whether every API FCM requires exists in this (simulated) sw context — always true.
Returns
Promise<boolean>
onBackgroundMessage()
function onBackgroundMessage(messaging: Messaging, nextOrObserver:
| NextFn<MessagePayload>
| Observer<MessagePayload>): Unsubscribe;
Called when a message arrives while the app has NO visible window client
(oracle: messaging-web-onbackgroundmessage,
messaging-web-visibility-routing). A DATA-ONLY message still fires with
no notification key (oracle: messaging-web-data-only-background). As in
Firebase, registering a handler suppresses SDK auto-display. A handler that
runs in a real Service Worker may use self.registration.showNotification();
the in-page fallback has no native display plane.
Parameters
| Parameter | Type |
|---|---|
messaging | Messaging |
nextOrObserver | | NextFn<MessagePayload> | Observer<MessagePayload> |
Returns
References
DeliverSpec
Re-exports DeliverSpec
DeliveryResult
Re-exports DeliveryResult
FcmOptions
Re-exports FcmOptions
GetTokenOptions
Re-exports GetTokenOptions
MessagePayload
Re-exports MessagePayload
Messaging
Re-exports Messaging
NextFn
Re-exports NextFn
NotificationPayload
Re-exports NotificationPayload
Observer
Re-exports Observer
SimulatedServiceWorkerRegistration
Re-exports SimulatedServiceWorkerRegistration
Unsubscribe
Re-exports Unsubscribe