Spaces:
Paused

MindPulse / frontend /lib /load-plotly.ts
qang0004
- PicSeq 3D Plotly brain HTML and 4-panel PNG
17e1ada
Raw History Blame Contribute Delete
552 Bytes
let plotlyPromise: Promise<any> | null = null
export function loadPlotly() {
if (!plotlyPromise) {
plotlyPromise = Promise.all([
import('plotly.js/lib/core'),
import('plotly.js/lib/heatmap'),
import('plotly.js/lib/scatter'),
]).then(([coreModule, heatmapModule, scatterModule]) => {
const Plotly = coreModule.default ?? coreModule
Plotly.register([
heatmapModule.default ?? heatmapModule,
scatterModule.default ?? scatterModule,
])
return Plotly
})
}
return plotlyPromise
}