aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/responsive.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/responsive.js')
-rw-r--r--app/scripts/responsive.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/app/scripts/responsive.js b/app/scripts/responsive.js
new file mode 100644
index 000000000..512065309
--- /dev/null
+++ b/app/scripts/responsive.js
@@ -0,0 +1,33 @@
+const startPopup = require('./responsive-core')
+const PortStream = require('./lib/port-stream.js')
+const ExtensionPlatform = require('./platforms/extension')
+const extension = require('extensionizer')
+const NotificationManager = require('./lib/notification-manager')
+const notificationManager = new NotificationManager()
+
+// create platform global
+global.platform = new ExtensionPlatform()
+
+// inject css
+const css = MetaMaskUiCss()
+injectCss(css)
+
+// setup stream to background
+const extensionPort = extension.runtime.connect({ name: 'ui' })
+const connectionStream = new PortStream(extensionPort)
+
+// start ui
+const container = document.getElementById('app-content')
+startPopup({ container, connectionStream }, (err, store) => {
+ if (err) return displayCriticalError(err)
+ store.subscribe(() => {
+ const state = store.getState()
+ })
+})
+
+function displayCriticalError (err) {
+ container.innerHTML = '<div class="critical-error">The MetaMask app failed to load: please open and close MetaMask again to restart.</div>'
+ container.style.height = '80px'
+ log.error(err.stack)
+ throw err
+}