import { MetaframeId } from "./core"; import { MetapageDefinition } from "./v2"; import { MetapageIFrameRpcClient } from "./MetapageIFrameRpcClient"; export enum MetapageEvents { Inputs = "inputs", Outputs = "outputs", State = "state", // The definition has already changed e.g. a metaframe changes its hash params // so the current definition now contains that change Definition = "definition", // Always emitted by updateDefinition, includes diff of added/removed metaframes DefinitionUpdate = "definitionupdate", Error = "error", Warning = "warning", // when a metaframe wants to tell the metapage of the new URL (for saving state/config) UrlHashUpdate = "urlhashupdate", // general event, all events are emitted in their raw form to this namespace Message = "Message", } export interface MetapageEventDefinition { definition: MetapageDefinition; metaframes: { [key: string]: MetapageIFrameRpcClient; }; } export interface MetapageEventDefinitionUpdate { definition: MetapageDefinition; metaframes: { current: { [key: string]: MetapageIFrameRpcClient }; added: { [key: string]: MetapageIFrameRpcClient }; removed: { [key: string]: MetapageIFrameRpcClient }; }; } export type MetapageEventUrlHashUpdate = { metaframe: MetaframeId; hash: string; };