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