1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-25 12:13:17 +00:00
musix-oss/node_modules/@firebase/messaging/dist/testing/fakes/service-worker.d.ts

84 lines
2.6 KiB
TypeScript
Raw Normal View History

2020-03-03 20:30:50 +00:00
/**
* @license
* Copyright 2019 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare function mockServiceWorker(): void;
export declare function restoreServiceWorker(): void;
export declare class FakeServiceWorkerRegistration implements ServiceWorkerRegistration {
active: null;
installing: null;
waiting: null;
onupdatefound: null;
pushManager: FakePushManager;
scope: string;
navigationPreload: NavigationPreloadManager;
sync: SyncManager;
updateViaCache: ServiceWorkerUpdateViaCache;
getNotifications(): Promise<never[]>;
showNotification(): Promise<void>;
update(): Promise<void>;
unregister(): Promise<boolean>;
addEventListener(): void;
removeEventListener(): void;
dispatchEvent(): boolean;
}
declare class FakePushManager implements PushManager {
private subscription;
permissionState(): Promise<"granted">;
getSubscription(): Promise<FakePushSubscription | null>;
subscribe(): Promise<FakePushSubscription>;
}
export declare class FakePushSubscription implements PushSubscription {
endpoint: string;
expirationTime: number;
auth: string;
p256: string;
getKey(name: PushEncryptionKeyName): Uint8Array;
unsubscribe(): Promise<boolean>;
toJSON: () => PushSubscriptionJSON;
options: PushSubscriptionOptions;
}
/**
* Most of the fields in here are unused / deprecated.
* They are only added here to match the TS Event interface.
*/
export declare class FakeEvent implements ExtendableEvent {
type: string;
NONE: number;
AT_TARGET: number;
BUBBLING_PHASE: number;
CAPTURING_PHASE: number;
bubbles: boolean;
cancelable: boolean;
composed: boolean;
timeStamp: number;
isTrusted: boolean;
eventPhase: number;
target: null;
currentTarget: null;
srcElement: null;
cancelBubble: boolean;
defaultPrevented: boolean;
returnValue: boolean;
preventDefault(): void;
stopPropagation(): void;
stopImmediatePropagation(): void;
initEvent(): void;
waitUntil(): void;
composedPath(): never[];
constructor(type: string, options?: EventInit);
}
export {};