Spaces:
Running
Running
Download static/analysis.js from minjiechen/OpenPELS: direct link, hf CLI and curl.
- Browser
- Download file 976 Bytes
-
https://huggingface.co/spaces/minjiechen/OpenPELS/resolve/main/static/analysis.js
- Command line
-
hf download hf://spaces/minjiechen/OpenPELS/static/analysis.js
-
curl -L -o analysis.js https://huggingface.co/spaces/minjiechen/OpenPELS/resolve/main/static/analysis.js
976 Bytes
| /** Carry the selected reference into the existing analytical workbench. */ | |
| export function createAnalysis(report, onPoint) { | |
| const frame = document.querySelector("#comparison"); | |
| let ready = false, | |
| selection = null; | |
| function deliver() { | |
| if (ready && selection) | |
| frame.contentWindow.postMessage( | |
| { type: "pe:topology", ...selection }, | |
| location.origin, | |
| ); | |
| } | |
| window.addEventListener("message", (event) => { | |
| if ( | |
| event.origin !== location.origin || | |
| event.source !== frame.contentWindow | |
| ) | |
| return; | |
| if (event.data?.type === "pe:analysis-ready") { | |
| ready = true; | |
| deliver(); | |
| } | |
| if (event.data?.type === "pe:analysis-point") onPoint(event.data); | |
| if (event.data?.type === "pe:analysis-error") report(event.data.message); | |
| }); | |
| function show(next) { | |
| if (next) selection = next; | |
| if (!frame.getAttribute("src")) frame.src = frame.dataset.src; | |
| deliver(); | |
| } | |
| return { show }; | |
| } | |