Embed React improvements (#2782)
* Add off support. Add getApi export. * Add publish command * Add embed-snippet in prod deps * Update README * Update package.json Co-authored-by: Bailey Pumfleet <pumfleet@hey.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Bailey Pumfleet
zomars
kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
parent
a7f7b29bae
commit
6148e89425
@@ -1,3 +1,17 @@
|
||||
import { CalWindow } from "@calcom/embed-snippet";
|
||||
|
||||
import Cal from "./Cal";
|
||||
|
||||
export const getCalApi = (): Promise<CalWindow["Cal"]> =>
|
||||
new Promise(function tryReadingFromWindow(resolve) {
|
||||
const api = (window as CalWindow).Cal;
|
||||
if (!api) {
|
||||
setTimeout(() => {
|
||||
tryReadingFromWindow(resolve);
|
||||
}, 50);
|
||||
return;
|
||||
}
|
||||
resolve(api);
|
||||
});
|
||||
|
||||
export default Cal;
|
||||
|
||||
Reference in New Issue
Block a user