UNPKG

928 BTypeScriptView Raw
1import Channel, { ChannelEvent, ChannelHandler } from '@storybook/channels';
2interface Config {
3 page: 'manager' | 'preview';
4}
5export declare const KEY = "storybook-channel";
6export declare class PostmsgTransport {
7 private readonly config;
8 private buffer;
9 private handler;
10 private connected;
11 constructor(config: Config);
12 setHandler(handler: ChannelHandler): void;
13 /**
14 * Sends `event` to the associated window. If the window does not yet exist
15 * the event will be stored in a buffer and sent when the window exists.
16 * @param event
17 */
18 send(event: ChannelEvent, options?: any): Promise<any>;
19 private flush;
20 private getFrames;
21 private getCurrentFrames;
22 private getLocalFrame;
23 private handleEvent;
24}
25/**
26 * Creates a channel which communicates with an iframe or child window.
27 */
28export default function createChannel({ page }: Config): Channel;
29export {};