@contentstack/live-preview-utils
Version:
Contentstack provides the Live Preview SDK to establish a communication channel between the various Contentstack SDKs and your website, transmitting live changes to the preview pane.
28 lines (27 loc) • 901 B
JavaScript
import {
require_dist
} from "../../chunk-LNSFZGX4.js";
import {
__toESM
} from "../../chunk-5WRI5ZAA.js";
// src/livePreview/eventManager/livePreviewEventManager.ts
var import_advanced_post_message = __toESM(require_dist(), 1);
import { LIVE_PREVIEW_CHANNEL_ID } from "./livePreviewEventManager.constant.js";
import { isOpeningInNewTab } from "../../common/inIframe.js";
var livePreviewPostMessage;
if (typeof window !== "undefined") {
const eventOptions = {
target: window.parent,
debug: false,
suppressErrors: true
};
if (isOpeningInNewTab()) {
eventOptions.target = window.opener;
}
livePreviewPostMessage = new import_advanced_post_message.EventManager(LIVE_PREVIEW_CHANNEL_ID, eventOptions);
}
var livePreviewEventManager_default = livePreviewPostMessage;
export {
livePreviewEventManager_default as default
};
//# sourceMappingURL=livePreviewEventManager.js.map