Improved typings of window.Cal (#7178)

This commit is contained in:
Matt Pocock authored and GitHub committed 2023-02-17 13:23:30 +00:00
1 parent 2f2f6006e6
commit 94f239bc42
7 files changed
+17 -18

No files matched your search

+3 -3
View File
@@ -1,12 +1,12 @@
import type { CalWindow } from "@calcom/embed-core";
import type { GlobalCal } from "@calcom/embed-core";
import EmbedSnippet from "@calcom/embed-snippet";
import Cal from "./Cal";
export const getCalApi = (): Promise<CalWindow["Cal"]> =>
export const getCalApi = (): Promise<GlobalCal> =>
new Promise(function tryReadingFromWindow(resolve) {
EmbedSnippet();
const api = (window as CalWindow).Cal;
const api = window.Cal;
if (!api) {
setTimeout(() => {
tryReadingFromWindow(resolve);