Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(function () { // BEFORE EACH TEST
this.appHistory = new createBrowserHistory();
this.store = store;
this.appRoot = renderIntoDocument(
);
this.findOnPage = createFinder(this.appRoot);
this.navigate = path => this.appHistory.pushState(null, path);
});
beforeEach(function () { // BEFORE EACH TEST
this.timeout(5000); // see https://mochajs.org/#timeouts
this.appHistory = new createBrowserHistory();
this.store = store;
this.appRoot = renderIntoDocument(
);
this.findOnPage = createFinder(this.appRoot);
this.navigate = path => this.appHistory.pushState(null, path);
});
const target = document.getElementById("root");
if (target == null) {
throw new Error("Unable to find root element!");
}
let initialRoot: string = target.dataset.initialRoot;
if (initialRoot == null) {
console.error(
`Initial root unset (${initialRoot}): this should not happen! ` +
'Falling back to ".".'
);
initialRoot = ".";
}
const basename = normalize(`${window.location.pathname}/${initialRoot}/`);
const history = createRelativeHistory(createBrowserHistory(), basename);
const routeData = createRouteDataFromEnvironment();
ReactDOM.hydrate(, target);
// In Chrome, relative favicon URLs are recomputed at every pushState,
// although other assets (like the `src` of an `img`) are not. We don't
// want to have to keep the shortcut icon's path up to date as we
// transition; it's simpler to make it absolute at page load.
for (const el of document.querySelectorAll('link[rel="shortcut icon"]')) {
const link: HTMLLinkElement = (el: any);
// (Appearances aside, this is not a no-op.)
link.href = link.href; // eslint-disable-line no-self-assign
}
import React from 'react';
import ReactDOM from 'react-dom';
import { HashRouter } from 'react-router-dom'
import createBrowserHistory from 'history/lib/createBrowserHistory';
import routes from './routes';
import { addLocaleData,IntlProvider } from 'react-intl';
import en from 'react-intl/locale-data/en';
import zh from 'react-intl/locale-data/zh';
import zh_CN from './message/zh_CN';
import en_US from './message/en_US';
let history = createBrowserHistory();
let locale = "en"
let messages = en_US
addLocaleData([...en, ...zh]);
if(window.location.href.indexOf("zh_CN")!=-1){
locale = "zh"
messages = zh_CN
}
const errorReporter = (error, locale, message) =>{
// custom error reporting code here
}
ReactDOM.render( {routes}, document.getElementById('app'));
// React components for Redux DevTools
import {DevTools, DebugPanel, LogMonitor} from 'redux-devtools/lib/react';
const reducer = combineReducers(Object.assign({}, reducers, {
routing: routeReducer
}));
const finalCreateStore = __DEVTOOLS ? compose(
// Provides support for DevTools:
devTools(),
// Lets you write ?debug_session= in address bar to persist debug sessions
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
)(createStore) : createStore;
const store = finalCreateStore(reducer);
const history = createBrowserHistory();
syncReduxAndRouter(history, store);
ReactDOM.render(
<div>
{getRoutes()}
{ __DEVTOOLS &&
}
</div>,
// LIBRARY
/*eslint-disable no-unused-vars*/
import React from 'react';
/*eslint-enable no-unused-vars*/
import {render} from 'react-dom';
import {Router} from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
// DEPENDENCY
import routes from './routes';
const history = createBrowserHistory();
if(typeof document !== 'undefined' && window) {
window.onload = () => {
render(, document.getElementById('app'));
};
}
localStorage.uuid = uuid = util.UUID();
}
socket.on('connect', () => socket.send('uuid', uuid));
socket.on('error', error => console.log(error.server + ': ' + error.message));
const routes = (
);
const history = createBrowserHistory();
render(, document.getElementById('root'));
import 'babel-core/register';
import ReactDOM from 'react-dom';
import React from 'react';
import { Router } from 'react-router';
import { Provider } from 'react-redux';
import { ReduxRouter } from 'redux-router';
import createBrowserHistory from 'history/lib/createBrowserHistory'
import configureStore from '../common/store/configureStore';
import routes from '../common/routes';
import "../../styles/index.css";
const history = createBrowserHistory();
const initialState = window.__INITIAL_STATE__;
const store = configureStore(initialState);
const rootElement = document.getElementById('root');
console.log(`suck it:`);
console.log(routes);
ReactDOM.render(
,
document.getElementById('root')
);
if (process.env.NODE_ENV !== 'production') {
var devtools = require('../server/devtools');
devtools.default(store);
import React from 'react';
import { Router, Route, Link } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import Home from './Component/Home';
import List from './Component/List';
import Article from './Component/Article';
import About from './Component/About';
import Construction from './Component/Construction';
const history = createBrowserHistory()
export default class AppRouter extends React.Component {
render() {
return (
);
}
}
import React from 'react';
import { render } from 'react-dom';
import { Router } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory'
import { Provider } from 'react-redux';
import * as reducers from 'reducers';
import routes from 'routes';
import promiseMiddleware from 'lib/promiseMiddleware';
import immutifyState from 'lib/immutifyState';
import { createStore,
combineReducers,
applyMiddleware } from 'redux';
const initialState = immutifyState(window.__INITIAL_STATE__);
const history = createBrowserHistory();
const reducer = combineReducers(reducers);
const store = applyMiddleware(promiseMiddleware)(createStore)(reducer, initialState);
render(
,
document.getElementById('react-view')
);