{"size": 954, "ext": "js", "max_stars_repo_path": "src/client.js", "max_stars_repo_name": "anibali/showoff", "max_stars_repo_stars_event_min_datetime": "2016-08-14T17:41:35.000Z", "max_stars_repo_stars_event_max_datetime": "2016-08-14T17:41:35.000Z", "max_issues_repo_path": "src/client.js", "max_issues_repo_name": "anibali/showoff", "max_issues_repo_issues_event_min_datetime": "2016-06-30T13:49:07.000Z", "max_issues_repo_issues_event_max_datetime": "2017-09-28T06:09:11.000Z", "max_forks_repo_path": "src/client.js", "max_forks_repo_name": "anibali/showoff", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 29.8125, "max_line_length": 85, "alphanum_fraction": 0.7096436059}
/**
 * This is the entrypoint for our application in the web browser.
 * When the web page is loaded, this code will run on the client.
 */

// eslint-disable-next-line
import 'babel-polyfill';

import React from 'react';
import ReactDOM from 'react-dom';
import { freeze } from 'icepick';

import createStore from './redux/createStore';
import WebSocketClient from './webSocketClient';
import ClientRoot from './components/ClientRoot';


window.main = (initialState) => {
  // Create a Redux store
  const store = createStore(freeze(initialState));

  const wsProtocol = window.location.protocol === 'http:' ? 'ws:' : 'wss:';
  window.wsc = new WebSocketClient(`${wsProtocol}//${window.location.host}/`, store);
  if(store.getState().auth.authenticated) {
    window.wsc.connect();
  }

  // Mount our React root component in the DOM
  const mountPoint = document.getElementById('root');
  ReactDOM.hydrate(<ClientRoot store={store} />, mountPoint);
};
