diff --git a/src/compiler/compile.ts b/src/compiler/compile.ts index 45b46ab0..b2381e8c 100644 --- a/src/compiler/compile.ts +++ b/src/compiler/compile.ts @@ -8,6 +8,7 @@ import type { UrlToFetchOptions } from 'src/core/gosling-component'; import { renderHiGlass as createHiGlassModels } from './create-higlass-models'; import { manageResponsiveSpecs } from './responsive'; import type { IdTable } from '../api/track-and-view-ids'; +import { publish } from '../api/pubsub'; /** The callback function called everytime after the spec has been compiled */ export type CompileCallback = ( @@ -69,6 +70,13 @@ export function compile( trackInfos = getRelativeTrackInfo(specCopy, theme).trackInfos; } + // publish the fixed spec + // used for alt-gosling + publish('specProcessed', { + id: specCopy.id, + spec: specCopy + }); + // Make HiGlass models for individual tracks createHiGlassModels(specCopy, trackInfos, callback, theme, urlToFetchOptions); } diff --git a/src/gosling-schema/gosling.schema.ts b/src/gosling-schema/gosling.schema.ts index dac259bc..f6fd1d00 100644 --- a/src/gosling-schema/gosling.schema.ts +++ b/src/gosling-schema/gosling.schema.ts @@ -284,6 +284,13 @@ interface CommonEventData { data: Datum[]; } +interface SpecEventData { + /** Source visualization ID, i.e., `track.id` */ + id: string; + /** Gosling spec */ + spec: GoslingSpec; +} + export interface GenomicPosition { chromosome: string; position: number; @@ -372,6 +379,7 @@ export type _EventMap = { click: PointMouseEventData; rangeSelect: RangeMouseEventData; rawData: CommonEventData; + specProcessed: SpecEventData; trackMouseOver: TrackApiData; trackClick: TrackApiData; // TODO (Jul-25-2022): with https://github.com/higlass/higlass/pull/1098, we can support circular layouts onNewTrack: OnNewTrackEventData;