1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 10:30:04 +01:00

Merge pull request #2230 from MetaMask/ui-dev-fix

development - fix ui dev
This commit is contained in:
Dan Finlay 2017-09-29 12:11:48 -07:00 committed by GitHub
commit 77963e8417
2 changed files with 75 additions and 72 deletions

View File

@ -3,62 +3,58 @@
<head>
<meta charset="utf-8">
<title>MetaMask</title>
</head>
<body>
<!-- app content -->
<div id="app-content" style="height: 100%"></div>
<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>
<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>

View File

@ -61,30 +61,37 @@ const actions = {
var css = MetaMaskUiCss()
injectCss(css)
const container = document.querySelector('#test-container')
// parse opts
var store = configureStore(states[selectedView])
// start app
render(
h('.super-dev-container', [
startApp()
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', {
style: {
height: '500px',
width: '360px',
boxShadow: 'grey 0px 2px 9px',
margin: '20px',
},
}, [
h(Root, {
store: store,
}),
]),
render(
h('.super-dev-container', [
]
), container)
h(Selector, { actions, selectedKey: selectedView, states, store }),
h('#app-content', {
style: {
height: '500px',
width: '360px',
boxShadow: 'grey 0px 2px 9px',
margin: '20px',
},
}, [
h(Root, {
store: store,
}),
]),
]
), container)
}