-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22575 from storybookjs/norbert/serverchannel-mana…
…ger-fix only connect to serverChannel in development mode
- Loading branch information
Showing
4 changed files
with
15 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
export async function generateAddonSetupCode() { | ||
return ` | ||
import { global } from '@storybook/global'; | ||
import { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; | ||
import { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; | ||
import { addons } from '@storybook/preview-api'; | ||
const channel = createPostMessageChannel({ page: 'preview' }); | ||
addons.setChannel(channel); | ||
window.__STORYBOOK_ADDONS_CHANNEL__ = channel; | ||
const serverChannel = createWebSocketChannel({}); | ||
addons.setServerChannel(serverChannel); | ||
window.__STORYBOOK_SERVER_CHANNEL__ = serverChannel; | ||
if (global.CONFIG_TYPE === 'DEVELOPMENT'){ | ||
const serverChannel = createWebSocketChannel({}); | ||
addons.setServerChannel(serverChannel); | ||
window.__STORYBOOK_SERVER_CHANNEL__ = serverChannel; | ||
} | ||
`.trim(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters