Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (isBrowser) {
try {
channel = addons.getChannel();
} catch (e) {
channel = createChannel({ page: 'preview' });
addons.setChannel(channel);
}
}
let storyStore;
let clientApi;
if (typeof window !== 'undefined' && window.__STORYBOOK_CLIENT_API__) {
clientApi = window.__STORYBOOK_CLIENT_API__;
// eslint-disable-next-line no-underscore-dangle
storyStore = clientApi._storyStore;
} else {
storyStore = new StoryStore({ channel });
clientApi = new ClientApi({ storyStore, decorateStory });
}
const { clearDecorators } = clientApi;
const configApi = new ConfigApi({ clearDecorators, storyStore, channel, clientApi });
return {
configApi,
storyStore,
channel,
clientApi,
showMain,
showError,
showException,
};
};
})();
constructor() {
this._addons = {};
this._decorators = [];
this._stories = new StoryStore({ channel: null });
this._clientApi = new ClientApi({ storyStore: this._stories });
}