Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!focusInInput(event)) {
// We have to pick off the keys of the event that we need on the other side
const { altKey, ctrlKey, metaKey, shiftKey, key, code, keyCode } = event;
channel.emit(Events.PREVIEW_KEYDOWN, {
event: { altKey, ctrlKey, metaKey, shiftKey, key, code, keyCode },
});
}
};
}
storyStore.on(Events.STORY_INIT, () => {
const { storyId, viewMode } = initializePath();
storyStore.setSelection({ storyId, viewMode });
});
storyStore.on(Events.STORY_RENDER, renderUI);
if (typeof window !== 'undefined') {
window.__STORYBOOK_CLIENT_API__ = clientApi;
window.__STORYBOOK_ADDONS_CHANNEL__ = channel; // may not be defined
}
let previousExports = {};
const loadStories = req => () => {
req.keys().forEach(filename => {
const fileExports = req(filename);
// An old-style story file
if (!fileExports.componentMeta) {
return;
}
setTimeout(() => this.emit(Events.STORY_RENDER), 1);
};
componentWillUnmount() {
const channel = addons.getChannel();
channel.removeListener(Events.STORY_RENDER, this.forceReRender);
channel.removeListener(Events.FORCE_RE_RENDER, this.forceReRender);
}