import { ClientConnection } from 'message-event-channel'; import { HandlerContainer } from './handler-container'; export declare const KEY = "visualization-sdk:context"; export declare enum CONTEXT_EVENTS { GET = "visualization-sdk:context:get", CHANGE = "visualization-sdk:context:change" } export declare type ContextModel = IContext; export declare type ContextChangeHandler = (context: ContextModel) => void; export declare type ContextChangeDispose = () => void; export interface IContext { contentId: string; contentTypeUri: string; snapshotId: string | null; deliveryKey: string | null; } /** * Contex class allows you to get the context information of the content item you're viewing and watch for changes to asynchronously update your application */ export declare class Context { connection: ClientConnection; changeHandlerContainer: HandlerContainer; constructor(connection: ClientConnection); /** * Get the current context information for the content item you're viewing * * ### Example * * ```typescript * const value = await visualization.context.get(); * * console.log(value) * ``` */ get(): Promise; /** * Sets up a listener for when the content item context information changes. * * @param cb - callback function to be called when context information changes. * * @returns a dispose function which removes the listener * * ### Example * * ```typescript * const dispose = visualization.context.changed((model) => { * // handle context change * }) * ``` */ changed(cb: ContextChangeHandler): ContextChangeDispose; }