UNPKG

@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.

1 lines 1.06 kB
{"version":3,"sources":["../../../src/livePreview/onPageTraversal.ts"],"sourcesContent":["import livePreviewPostMessage from \"./eventManager/livePreviewEventManager\";\nimport { LIVE_PREVIEW_POST_MESSAGE_EVENTS } from \"./eventManager/livePreviewEventManager.constant\";\n\nexport function handlePageTraversal(): void {\n window.addEventListener(\"unload\", () => {\n const targetURL = (document.activeElement as HTMLAnchorElement).href;\n if (targetURL) {\n livePreviewPostMessage?.send(\n LIVE_PREVIEW_POST_MESSAGE_EVENTS.URL_CHANGE,\n {\n targetURL,\n }\n );\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qCAAmC;AACnC,IAAAA,kCAAiD;AAE1C,SAAS,sBAA4B;AACxC,SAAO,iBAAiB,UAAU,MAAM;AACpC,UAAM,YAAa,SAAS,cAAoC;AAChE,QAAI,WAAW;AACX,qCAAAC,SAAwB;AAAA,QACpB,iEAAiC;AAAA,QACjC;AAAA,UACI;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,CAAC;AACL;","names":["import_livePreviewEventManager","livePreviewPostMessage"]}