How to use the react-cosmos-shared2/FixtureLoader.createWebSocketsConnect function in react-cosmos-shared2

To help you get started, we’ve selected a few react-cosmos-shared2 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 react-cosmos / react-cosmos / packages / react-cosmos / src / dom / rendererConnect.tsx View on Github external
import {
  createPostMessageConnect,
  createWebSocketsConnect
} from 'react-cosmos-shared2/FixtureLoader';
import { isInsideCosmosPreviewIframe } from './shared';

export const rendererConnect = isInsideCosmosPreviewIframe()
  ? createPostMessageConnect()
  : createWebSocketsConnect(getWebSocketsUrl());

function getWebSocketsUrl() {
  // TODO: Allow user to input URL
  return location.origin;
}
github react-cosmos / react-cosmos / packages / react-cosmos / src / native.tsx View on Github external
export function NativeFixtureLoader({
  rendererConfig: { port },
  fixtures,
  decorators
}: Props) {
  const socketUrl = getSocketUrl(port);
  return (
    
  );
}
github react-cosmos / react-cosmos / packages / react-cosmos / src / native.tsx View on Github external
export function NativeFixtureLoader({
  rendererConfig: { port },
  fixtures,
  decorators
}: Props) {
  const socketUrl = getSocketUrl(port);
  return (
    
  );
}