diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2017-09-30 03:11:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-30 03:11:48 +0800 |
commit | 77963e84170ee39c9d227e7cc4097b19f947099b (patch) | |
tree | c47828bb97545494b179691bf11de463d76e046d | |
parent | d61f36808a6cad8e770cc66701eb09f40160ab4d (diff) | |
parent | 19e7adad1920ac506b3ef5c639ec110a2615bd7c (diff) | |
download | tangerine-wallet-browser-77963e84170ee39c9d227e7cc4097b19f947099b.tar tangerine-wallet-browser-77963e84170ee39c9d227e7cc4097b19f947099b.tar.gz tangerine-wallet-browser-77963e84170ee39c9d227e7cc4097b19f947099b.tar.bz2 tangerine-wallet-browser-77963e84170ee39c9d227e7cc4097b19f947099b.tar.lz tangerine-wallet-browser-77963e84170ee39c9d227e7cc4097b19f947099b.tar.xz tangerine-wallet-browser-77963e84170ee39c9d227e7cc4097b19f947099b.tar.zst tangerine-wallet-browser-77963e84170ee39c9d227e7cc4097b19f947099b.zip |
Merge pull request #2230 from MetaMask/ui-dev-fix
development - fix ui dev
-rw-r--r-- | development/index.html | 84 | ||||
-rw-r--r-- | ui-dev.js | 51 |
2 files changed, 69 insertions, 66 deletions
diff --git a/development/index.html b/development/index.html index a0814cb55..e5a027447 100644 --- a/development/index.html +++ b/development/index.html @@ -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> - </body> + <script> + liveReloadCode(Date.now(), 300) + function liveReloadCode(lastUpdate, updateRate) { + setTimeout(iter, updateRate) -<style> -html, body, #test-container, .super-dev-container { - height: 100%; - width: 100%; - position: relative; - background: white; -} -#app-content { - background: #F7F7F7; -} -</style> + function iter() { + var xhr = new XMLHttpRequest() -<script> -liveReloadCode(Date.now(), 300) -function liveReloadCode(lastUpdate, updateRate) { - setTimeout(iter, updateRate) + xhr.open('GET', '/-/live-reload') + xhr.onreadystatechange = function() { + if(xhr.readyState !== 4) { + return + } - function iter() { - var xhr = new XMLHttpRequest() + try { + var change = JSON.parse(xhr.responseText).lastUpdate - xhr.open('GET', '/-/live-reload') - xhr.onreadystatechange = function() { - if(xhr.readyState !== 4) { - return - } + if(lastUpdate < change) { + return reload() + } + } catch(err) { + } - try { - var change = JSON.parse(xhr.responseText).lastUpdate + xhr = + xhr.onreadystatechange = null + setTimeout(iter, updateRate) + } - if(lastUpdate < change) { - return reload() + xhr.send(null) } - } catch(err) { } - xhr = - xhr.onreadystatechange = null - setTimeout(iter, updateRate) - } - - xhr.send(null) - } -} + function reload() { + window.location.reload() + } + </script> -function reload() { - window.location.reload() -} - </script> + </body> </html> @@ -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', [ - - 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) +startApp() + +function startApp(){ + const body = document.body + const container = document.createElement('div') + container.id = 'test-container' + body.appendChild(container) + + render( + h('.super-dev-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) +} |