import { ChartMode, DataRepresentation } from './DataTypes'; /** * What caused a chart change * 'user' - the embedded radio controls were operated by a person * 'api' - a public method was called by the host application */ export type ChartEventTrigger = 'user' | 'api'; /** * Where a reported error originated */ export type ChartErrorPhase = 'view-change' | 'resize'; /** * Emitted after the rendered view has changed to a new mode/representation pair * * Only fires for committed transitions. The config-only setters mode(), * representation() and configure() do not reload data or re-render, so they * emit nothing - see switchDataSource() for the observable programmatic path. */ export interface ViewChangedEvent { /** Mode now displayed */ mode: ChartMode; /** Representation now displayed */ representation: DataRepresentation; /** Mode displayed before this change */ previousMode: ChartMode; /** Representation displayed before this change */ previousRepresentation: DataRepresentation; /** Whether a person or the host application caused the change */ trigger: ChartEventTrigger; } /** * Emitted when the chart fails outside of a public method call * * Public methods still throw as before. This covers the two paths where the host * has no stack frame to catch: the embedded controls' change handler and the * resize observer callback. */ export interface ChartErrorEvent { /** The underlying error */ error: Error; /** Which internal operation failed */ phase: ChartErrorPhase; } /** * Public event catalogue * * Declared as a type alias rather than an interface on purpose: interfaces have * no implicit index signature and would not satisfy the * Record constraint on EventEmitter. */ export type ChartEventMap = { 'view.changed': ViewChangedEvent; 'chart.error': ChartErrorEvent; }; /** * Name of a public chart event */ export type ChartEventName = keyof ChartEventMap; /** * Listener signature for a public chart event */ export type ChartEventListener = (payload: ChartEventMap[K]) => void; /** * Listeners supplied through the constructor's events option */ export type ChartEventListeners = { [K in ChartEventName]?: ChartEventListener | undefined; }; /** * Removes a previously registered listener. Idempotent. */ export type ChartUnsubscribe = () => void; //# sourceMappingURL=EventTypes.d.ts.map