Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
export function NativeFixtureLoader({
rendererConfig: { port },
fixtures,
decorators
}: Props) {
const socketUrl = getSocketUrl(port);
return (
);
}
export function NativeFixtureLoader({
rendererConfig: { port },
fixtures,
decorators
}: Props) {
const socketUrl = getSocketUrl(port);
return (
);
}