Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} catch (ex) {
showException(ex);
}
}
};
const forceReRender = () => renderUI(true);
// channel can be null in NodeJS
if (isBrowser) {
const deprecatedToId = deprecate(
toId,
`Passing name+kind to the SET_CURRENT_STORY event is deprecated, use a storyId instead`
);
channel.on(Events.FORCE_RE_RENDER, forceReRender);
channel.on(Events.SET_CURRENT_STORY, ({ storyId: inputStoryId, name, kind, viewMode }) => {
let storyId = inputStoryId;
// For backwards compatibility
if (!storyId) {
if (!name || !kind) {
throw new Error('You should pass `storyId` into SET_CURRENT_STORY');
}
storyId = deprecatedToId(kind, name);
}
storyStore.setSelection({ storyId, viewMode });
setPath({ storyId, viewMode });
});
// Handle keyboard shortcuts
window.onkeydown = event => {
const increment = () => {
timesClicked += 1;
addons.getChannel().emit(Events.FORCE_RE_RENDER);
};
const increment = () => {
timesClicked += 1;
addons.getChannel().emit(Events.FORCE_RE_RENDER);
};
const increment = () => {
timesClicked += 1;
addons.getChannel().emit(Events.FORCE_RE_RENDER);
};
componentWillUnmount() {
const channel = addons.getChannel();
channel.removeListener(Events.STORY_RENDER, this.forceReRender);
channel.removeListener(Events.FORCE_RE_RENDER, this.forceReRender);
}