How to use the @storybook/core-events.REGISTER_SUBSCRIPTION 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 / addons / viewport / src / preview / withViewport.js View on Github external
const applyViewportOptions = (options = {}) => {
  const channel = addons.getChannel();

  handler = options.onViewportChange || noop;
  if (options.onViewportChange) {
    channel.emit(CoreEvents.REGISTER_SUBSCRIPTION, subscription);
  }

  channel.emit(SET_STORY_DEFAULT_VIEWPORT_EVENT_ID, options.name || DEFAULT_VIEWPORT);
};
github storybookjs / storybook / addons / events / src / deprecated.js View on Github external
const addEvents = ({ emit, events }) => {
  if (prevEvents !== events) {
    addons.getChannel().emit(EVENTS.ADD, events);
    prevEvents = events;
  }
  currentEmit = emit;
  addons.getChannel().emit(CoreEvents.REGISTER_SUBSCRIPTION, subscription);
};
github storybookjs / storybook / lib / client-api / src / client_api.js View on Github external
const metaSubscription = () => {
  addons.getChannel().on(Events.REGISTER_SUBSCRIPTION, subscriptionsStore.register);
  return () =>
    addons.getChannel().removeListener(Events.REGISTER_SUBSCRIPTION, subscriptionsStore.register);
};
github storybookjs / storybook / lib / client-api / src / client_api.ts View on Github external
const metaSubscription = () => {
  addons.getChannel().on(Events.REGISTER_SUBSCRIPTION, metaSubscriptionHandler);
  return () =>
    addons.getChannel().removeListener(Events.REGISTER_SUBSCRIPTION, metaSubscriptionHandler);
};
github storybookjs / storybook / lib / client-api / src / client_api.ts View on Github external
return () =>
    addons.getChannel().removeListener(Events.REGISTER_SUBSCRIPTION, metaSubscriptionHandler);
};
github storybookjs / storybook / lib / client-api / src / client_api.js View on Github external
return () =>
    addons.getChannel().removeListener(Events.REGISTER_SUBSCRIPTION, subscriptionsStore.register);
};
github storybookjs / storybook / lib / client-api / src / client_api.js View on Github external
return () =>
    addons.getChannel().removeListener(Events.REGISTER_SUBSCRIPTION, subscriptionsStore.register);
};
github storybookjs / storybook / lib / client-api / src / client_api.js View on Github external
const metaSubscription = () => {
  addons.getChannel().on(Events.REGISTER_SUBSCRIPTION, subscriptionsStore.register);
  return () =>
    addons.getChannel().removeListener(Events.REGISTER_SUBSCRIPTION, subscriptionsStore.register);
};