-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
51 lines (44 loc) · 1.05 KB
/
index.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
const render = require('react-dom').render
const h = require('react-hyperscript')
const configureStore = require('./lib/store')
const Root = require('./app/root.js')
const Provider = require('react-redux').Provider
const qp = require('query-parse')
const params = qp.toObject(window.location.search.substr(1))
var body = document.querySelector('body')
const container = document.createElement('div')
body.appendChild(container)
window.addEventListener('load', function() {
// Now you can start your app & access web3 freely:
try {
if (web3 === undefined) {
window.web3 = false
}
} catch (e) {
window.web3 = false
}
startApp()
})
const store = configureStore({
currentView: 'home',
web3Found: !!window.web3,
editMode: true,
})
console.dir({ params })
store.dispatch({
type: 'PARAMS',
value: {
abi: unescape(params.abi),
address: params.address,
name: params.name,
},
})
function startApp(){
render(h('.super', [
// h('style', styles),
h(Provider, { store }, [
h(Root),
]),
]),
container)
}