import "@common/less/reset.css";
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import store from './store';
import {AppContainer} from 'react-hot-loader';
import HomePage from './modules/HomePage';
import $ from 'jquery';
import "@utils/jqprint";

const render = (Component) => {
  //ie8 console兼容
  window.console = window.console || (function () {
    var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
      = c.clear = c.exception = c.trace = c.assert = function () { };
    return c;
  })();
  //ie8 onInput替代函数
  $.fn.onIe8Input = function (fn,thisVal) {
    return this.each(function () {
      var $this = $(this);
      var htmlold = $this.html();
      $this.bind('blur keyup paste cut mouseup', function (e) {
        var htmlnew = $this.html();
        if (htmlold !== htmlnew) {
          fn.call(thisVal,e);
        }
      })
    })
  };          
    ReactDOM.render(
        <AppContainer>
            <Provider store={store}>
                <Component/>
            </Provider>
        </AppContainer>,
        document.getElementById('root')
    );
};


render(HomePage);

if (module.hot) {
    module.hot.accept();
}