How to use the @storybook/core-events.STORY_RENDER function in @storybook/core-events

To help you get started, we’ve selected a few @storybook/core-events examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / lib / core / src / client / preview / start.js View on Github external
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;
      }
github storybookjs / storybook / lib / client-api / src / story_store.js View on Github external
    setTimeout(() => this.emit(Events.STORY_RENDER), 1);
  };
github storybookjs / storybook / app / react-native / src / preview / components / StoryView / index.tsx View on Github external
componentWillUnmount() {
    const channel = addons.getChannel();
    channel.removeListener(Events.STORY_RENDER, this.forceReRender);
    channel.removeListener(Events.FORCE_RE_RENDER, this.forceReRender);
  }