mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
* Change `object` to `Record<string, unknown>` * Change `object` to `Record<string, unknown>` Pt. 2 * Update ForegroundSyncService - Manage finish message in the listener to more gaurantee a message back - Make the timeout much longer - Allow it to throw if the background sync service threw --------- Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>
26 lines
697 B
TypeScript
26 lines
697 B
TypeScript
import { map } from "rxjs";
|
|
|
|
import { CommandDefinition } from "./types";
|
|
|
|
export const getCommand = (
|
|
commandDefinition: CommandDefinition<Record<string, unknown>> | string,
|
|
) => {
|
|
if (typeof commandDefinition === "string") {
|
|
return commandDefinition;
|
|
} else {
|
|
return commandDefinition.command;
|
|
}
|
|
};
|
|
|
|
export const EXTERNAL_SOURCE_TAG = Symbol("externalSource");
|
|
|
|
export const isExternalMessage = (message: Record<PropertyKey, unknown>) => {
|
|
return message?.[EXTERNAL_SOURCE_TAG] === true;
|
|
};
|
|
|
|
export const tagAsExternal = <T extends Record<PropertyKey, unknown>>() => {
|
|
return map((message: T) => {
|
|
return Object.assign(message, { [EXTERNAL_SOURCE_TAG]: true });
|
|
});
|
|
};
|