How to use the @storybook/core-events.STORY_RENDERED 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 / app / react-native / src / preview / components / StoryView / index.tsx View on Github external
componentDidUpdate() {
    const channel = addons.getChannel();
    const { stories } = this.props;
    const { storyId } = stories.getSelection();

    if (storyId) {
      channel.emit(Events.STORY_RENDERED, { storyId });
    }
  }
github storybookjs / storybook / lib / core / src / client / preview / start.js View on Github external
});
      return;
    }

    if (!forceRender && previousKind && previousStory) {
      addons.getChannel().emit(Events.STORY_CHANGED, id);
    }

    if (viewMode === 'docs') {
      const NoDocs = () =&gt; <div style="{{">No docs found</div>;
      const StoryDocs = (parameters &amp;&amp; parameters.docs) || NoDocs;
      ReactDOM.render(, document.getElementById('root'));
    } else if (!viewMode || viewMode === 'story') {
      if (getDecorated) {
        render(renderContext);
        addons.getChannel().emit(Events.STORY_RENDERED, id);
      } else {
        showNopreview();
        addons.getChannel().emit(Events.STORY_MISSING, id);
      }
    }

    previousRevision = revision;
    previousKind = kind;
    previousStory = name;
    previousViewMode = viewMode;

    if (!forceRender) {
      document.documentElement.scrollTop = 0;
    }
  };