integration layer; merge work on indicators from forks with existing ingestion pipeline
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
import { PlotlyFigure } from '../../features/indicadores/indicadores.models';
|
||||
|
||||
// Narrow boundary for the official partial bundle, which ships without declarations.
|
||||
export interface PlotlyRuntime {
|
||||
react(host: HTMLElement, data: PlotlyFigure['data'], layout: PlotlyFigure['layout'], config: Record<string, unknown>): Promise<unknown>;
|
||||
purge(host: HTMLElement): void;
|
||||
Plots: { resize(host: HTMLElement): Promise<unknown> };
|
||||
addFrames(host: HTMLElement, frames: Record<string, unknown>[]): Promise<unknown>;
|
||||
deleteFrames(host: HTMLElement, indices: number[]): Promise<unknown>;
|
||||
}
|
||||
let runtime: Promise<PlotlyRuntime> | undefined;
|
||||
export function loadPlotly(): Promise<PlotlyRuntime> {
|
||||
return runtime ??= import('plotly.js-cartesian-dist-min')
|
||||
.then(module => (module.default ?? module) as unknown as PlotlyRuntime)
|
||||
.catch(error => { runtime = undefined; throw error; });
|
||||
}
|
||||
|
||||
export const PLOTLY_LOADER = new InjectionToken<() => Promise<PlotlyRuntime>>('PLOTLY_LOADER', { providedIn: 'root', factory: () => loadPlotly });
|
||||
|
||||
Reference in New Issue
Block a user