summaryrefslogtreecommitdiff
path: root/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2025-11-09 11:15:19 +0800
committeraltaf-creator <dev@altafcreator.com>2025-11-09 11:15:19 +0800
commit8eff962cab608341a6f2fedc640a0e32d96f26e2 (patch)
tree05534d1a720ddc3691d346c69b4972555820a061 /frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel
pain
Diffstat (limited to 'frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel')
-rw-r--r--frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/index.d.ts87
-rw-r--r--frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/promise.d.ts33
-rw-r--r--frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/receiver.d.ts63
-rw-r--r--frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/sender.d.ts46
4 files changed, 229 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/index.d.ts b/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/index.d.ts
new file mode 100644
index 0000000..78beb52
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/index.d.ts
@@ -0,0 +1,87 @@
+/**
+ * @license
+ * Copyright 2019 Google LLC
+ *
+ * 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.
+ */
+import { PromiseSettledResult } from './promise';
+export declare const enum _TimeoutDuration {
+ ACK = 50,
+ COMPLETION = 3000,
+ LONG_ACK = 800
+}
+/**
+ * Enumeration of possible response types from the Receiver.
+ */
+export declare const enum _Status {
+ ACK = "ack",
+ DONE = "done"
+}
+export declare const enum _MessageError {
+ CONNECTION_CLOSED = "connection_closed",
+ CONNECTION_UNAVAILABLE = "connection_unavailable",
+ INVALID_RESPONSE = "invalid_response",
+ TIMEOUT = "timeout",
+ UNKNOWN = "unknown_error",
+ UNSUPPORTED_EVENT = "unsupported_event"
+}
+/**
+ * Enumeration of possible events sent by the Sender.
+ */
+export declare const enum _EventType {
+ KEY_CHANGED = "keyChanged",
+ PING = "ping"
+}
+/**
+ * Response to a {@link EventType.KEY_CHANGED} event.
+ */
+export interface KeyChangedResponse {
+ keyProcessed: boolean;
+}
+/**
+ * Response to a {@link EventType.PING} event.
+ */
+export type _PingResponse = _EventType[];
+export type _ReceiverResponse = KeyChangedResponse | _PingResponse;
+interface MessageEvent {
+ eventType: _EventType;
+ eventId: string;
+}
+/**
+ * Request for a {@link EventType.KEY_CHANGED} event.
+ */
+export interface KeyChangedRequest {
+ key: string;
+}
+/**
+ * Request for a {@link EventType.PING} event.
+ */
+export interface PingRequest {
+}
+/** Data sent by Sender */
+export type _SenderRequest = KeyChangedRequest | PingRequest;
+/** Receiver handler to process events sent by the Sender */
+export interface ReceiverHandler<T extends _ReceiverResponse, S extends _SenderRequest> {
+ (origin: string, data: S): T | Promise<T>;
+}
+/** Full message sent by Sender */
+export interface SenderMessageEvent<T extends _SenderRequest> extends MessageEvent {
+ data: T;
+}
+export type _ReceiverMessageResponse<T extends _ReceiverResponse> = Array<PromiseSettledResult<T>> | null;
+/** Full message sent by Receiver */
+export interface ReceiverMessageEvent<T extends _ReceiverResponse> extends MessageEvent {
+ status: _Status;
+ response: _ReceiverMessageResponse<T>;
+}
+export {};
diff --git a/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/promise.d.ts b/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/promise.d.ts
new file mode 100644
index 0000000..d57013b
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/promise.d.ts
@@ -0,0 +1,33 @@
+/**
+ * @license
+ * Copyright 2019 Google LLC
+ *
+ * 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.
+ */
+/** TODO: remove this once tslib has a polyfill for Promise.allSettled */
+interface PromiseFulfilledResult<T> {
+ fulfilled: true;
+ value: T;
+}
+interface PromiseRejectedResult {
+ fulfilled: false;
+ reason: any;
+}
+export type PromiseSettledResult<T> = PromiseFulfilledResult<T> | PromiseRejectedResult;
+/**
+ * Shim for Promise.allSettled, note the slightly different format of `fulfilled` vs `status`.
+ *
+ * @param promises - Array of promises to wait on.
+ */
+export declare function _allSettled<T>(promises: Array<Promise<T>>): Promise<Array<PromiseSettledResult<T>>>;
+export {};
diff --git a/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/receiver.d.ts b/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/receiver.d.ts
new file mode 100644
index 0000000..394de7b
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/receiver.d.ts
@@ -0,0 +1,63 @@
+/**
+ * @license
+ * Copyright 2019 Google LLC
+ *
+ * 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.
+ */
+import { ReceiverHandler, _EventType, _ReceiverResponse, _SenderRequest } from './index';
+/**
+ * Interface class for receiving messages.
+ *
+ */
+export declare class Receiver {
+ private readonly eventTarget;
+ private static readonly receivers;
+ private readonly boundEventHandler;
+ private readonly handlersMap;
+ constructor(eventTarget: EventTarget);
+ /**
+ * Obtain an instance of a Receiver for a given event target, if none exists it will be created.
+ *
+ * @param eventTarget - An event target (such as window or self) through which the underlying
+ * messages will be received.
+ */
+ static _getInstance(eventTarget: EventTarget): Receiver;
+ private isListeningto;
+ /**
+ * Fans out a MessageEvent to the appropriate listeners.
+ *
+ * @remarks
+ * Sends an {@link Status.ACK} upon receipt and a {@link Status.DONE} once all handlers have
+ * finished processing.
+ *
+ * @param event - The MessageEvent.
+ *
+ */
+ private handleEvent;
+ /**
+ * Subscribe an event handler for a particular event.
+ *
+ * @param eventType - Event name to subscribe to.
+ * @param eventHandler - The event handler which should receive the events.
+ *
+ */
+ _subscribe<T extends _ReceiverResponse, S extends _SenderRequest>(eventType: _EventType, eventHandler: ReceiverHandler<T, S>): void;
+ /**
+ * Unsubscribe an event handler from a particular event.
+ *
+ * @param eventType - Event name to unsubscribe from.
+ * @param eventHandler - Optional event handler, if none provided, unsubscribe all handlers on this event.
+ *
+ */
+ _unsubscribe<T extends _ReceiverResponse, S extends _SenderRequest>(eventType: _EventType, eventHandler?: ReceiverHandler<T, S>): void;
+}
diff --git a/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/sender.d.ts b/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/sender.d.ts
new file mode 100644
index 0000000..a1121b6
--- /dev/null
+++ b/frontend-old/node_modules/@firebase/auth/dist/src/platform_browser/messagechannel/sender.d.ts
@@ -0,0 +1,46 @@
+/**
+ * @license
+ * Copyright 2019 Google LLC
+ *
+ * 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.
+ */
+import { _SenderRequest, _EventType, _ReceiverMessageResponse, _ReceiverResponse, _TimeoutDuration } from './index';
+/**
+ * Interface for sending messages and waiting for a completion response.
+ *
+ */
+export declare class Sender {
+ private readonly target;
+ private readonly handlers;
+ constructor(target: ServiceWorker);
+ /**
+ * Unsubscribe the handler and remove it from our tracking Set.
+ *
+ * @param handler - The handler to unsubscribe.
+ */
+ private removeMessageHandler;
+ /**
+ * Send a message to the Receiver located at {@link target}.
+ *
+ * @remarks
+ * We'll first wait a bit for an ACK , if we get one we will wait significantly longer until the
+ * receiver has had a chance to fully process the event.
+ *
+ * @param eventType - Type of event to send.
+ * @param data - The payload of the event.
+ * @param timeout - Timeout for waiting on an ACK from the receiver.
+ *
+ * @returns An array of settled promises from all the handlers that were listening on the receiver.
+ */
+ _send<T extends _ReceiverResponse, S extends _SenderRequest>(eventType: _EventType, data: S, timeout?: _TimeoutDuration): Promise<_ReceiverMessageResponse<T>>;
+}