development - fix ui dev
This commit is contained in:
parent
cdf41c2857
commit
19e7adad19
|
@ -3,62 +3,58 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>MetaMask</title>
|
<title>MetaMask</title>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<!-- app content -->
|
|
||||||
<div id="app-content" style="height: 100%"></div>
|
|
||||||
<script src="./bundle.js" type="text/javascript" charset="utf-8"></script>
|
<script src="./bundle.js" type="text/javascript" charset="utf-8"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
html, body, #test-container, .super-dev-container {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
#app-content {
|
||||||
|
background: #F7F7F7;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
liveReloadCode(Date.now(), 300)
|
||||||
|
function liveReloadCode(lastUpdate, updateRate) {
|
||||||
|
setTimeout(iter, updateRate)
|
||||||
|
|
||||||
|
function iter() {
|
||||||
|
var xhr = new XMLHttpRequest()
|
||||||
|
|
||||||
|
xhr.open('GET', '/-/live-reload')
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if(xhr.readyState !== 4) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var change = JSON.parse(xhr.responseText).lastUpdate
|
||||||
|
|
||||||
|
if(lastUpdate < change) {
|
||||||
|
return reload()
|
||||||
|
}
|
||||||
|
} catch(err) {
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr =
|
||||||
|
xhr.onreadystatechange = null
|
||||||
|
setTimeout(iter, updateRate)
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr.send(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reload() {
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<style>
|
|
||||||
html, body, #test-container, .super-dev-container {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
#app-content {
|
|
||||||
background: #F7F7F7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
liveReloadCode(Date.now(), 300)
|
|
||||||
function liveReloadCode(lastUpdate, updateRate) {
|
|
||||||
setTimeout(iter, updateRate)
|
|
||||||
|
|
||||||
function iter() {
|
|
||||||
var xhr = new XMLHttpRequest()
|
|
||||||
|
|
||||||
xhr.open('GET', '/-/live-reload')
|
|
||||||
xhr.onreadystatechange = function() {
|
|
||||||
if(xhr.readyState !== 4) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
var change = JSON.parse(xhr.responseText).lastUpdate
|
|
||||||
|
|
||||||
if(lastUpdate < change) {
|
|
||||||
return reload()
|
|
||||||
}
|
|
||||||
} catch(err) {
|
|
||||||
}
|
|
||||||
|
|
||||||
xhr =
|
|
||||||
xhr.onreadystatechange = null
|
|
||||||
setTimeout(iter, updateRate)
|
|
||||||
}
|
|
||||||
|
|
||||||
xhr.send(null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function reload() {
|
|
||||||
window.location.reload()
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
45
ui-dev.js
45
ui-dev.js
|
@ -61,30 +61,37 @@ const actions = {
|
||||||
var css = MetaMaskUiCss()
|
var css = MetaMaskUiCss()
|
||||||
injectCss(css)
|
injectCss(css)
|
||||||
|
|
||||||
const container = document.querySelector('#test-container')
|
|
||||||
|
|
||||||
// parse opts
|
// parse opts
|
||||||
var store = configureStore(states[selectedView])
|
var store = configureStore(states[selectedView])
|
||||||
|
|
||||||
// start app
|
// start app
|
||||||
render(
|
startApp()
|
||||||
h('.super-dev-container', [
|
|
||||||
|
|
||||||
h(Selector, { actions, selectedKey: selectedView, states, store }),
|
function startApp(){
|
||||||
|
const body = document.body
|
||||||
|
const container = document.createElement('div')
|
||||||
|
container.id = 'test-container'
|
||||||
|
body.appendChild(container)
|
||||||
|
|
||||||
h('#app-content', {
|
render(
|
||||||
style: {
|
h('.super-dev-container', [
|
||||||
height: '500px',
|
|
||||||
width: '360px',
|
|
||||||
boxShadow: 'grey 0px 2px 9px',
|
|
||||||
margin: '20px',
|
|
||||||
},
|
|
||||||
}, [
|
|
||||||
h(Root, {
|
|
||||||
store: store,
|
|
||||||
}),
|
|
||||||
]),
|
|
||||||
|
|
||||||
]
|
h(Selector, { actions, selectedKey: selectedView, states, store }),
|
||||||
), container)
|
|
||||||
|
h('#app-content', {
|
||||||
|
style: {
|
||||||
|
height: '500px',
|
||||||
|
width: '360px',
|
||||||
|
boxShadow: 'grey 0px 2px 9px',
|
||||||
|
margin: '20px',
|
||||||
|
},
|
||||||
|
}, [
|
||||||
|
h(Root, {
|
||||||
|
store: store,
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
|
||||||
|
]
|
||||||
|
), container)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue