aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--development/index.html84
-rw-r--r--ui-dev.js51
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>
diff --git a/ui-dev.js b/ui-dev.js
index de5dfd8ef..620d81667 100644
--- a/ui-dev.js
+++ b/ui-dev.js
@@ -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)
+}