-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
53 lines (46 loc) · 1.47 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React, {Component} from 'react'
import ReactDOM from 'react-dom'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import Paper from 'material-ui/Paper'
import { Router, Route, IndexRoute, hashHistory } from 'react-router'
import injectTapEventPlugin from 'react-tap-event-plugin'
injectTapEventPlugin()
import DiffPanel from './diff-panel/DiffPanel.jsx'
import BulkDiffPanel from './bulk-diff-panel/BulkDiffPanel.jsx'
require("!style!css!./node_modules/jsondiffpatch/public/formatters-styles/html.css")
// const NoMatch = React.createClass({/*...*/})
const STYLE = {
padding: '10px',
maxWidth: '700px',
marginLeft: 'auto',
marginRight: 'auto'
}
const App = React.createClass({
render() {
return (
<MuiThemeProvider>
<Paper style={STYLE}>
{this.props.children}
</Paper>
</MuiThemeProvider>
)
}
})
// <Route path="*" component={NoMatch}/>
ReactDOM.render(
<Router history={hashHistory}>
<Route path="/" component={App}>
<IndexRoute component={DiffPanel} />
<Route path="bulk" component={BulkDiffPanel}/>
</Route>
</Router>,
document.getElementById('container')
)
// service worker logic
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/jsondiff/sw.js').then(function(registration) {
console.debug('ServiceWorker registration successful with scope: ', registration.scope);
}).catch(function(err) {
console.debug('ServiceWorker registration failed: ', err);
})
}