mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Began creating new UI template
This commit is contained in:
parent
fa533469cb
commit
91cd849e76
@ -90,7 +90,8 @@ function setupController (initState) {
|
||||
|
||||
extension.runtime.onConnect.addListener(connectRemote)
|
||||
function connectRemote (remotePort) {
|
||||
var isMetaMaskInternalProcess = remotePort.name === 'popup' || remotePort.name === 'notification'
|
||||
const name = remotePort.name
|
||||
var isMetaMaskInternalProcess = name === 'popup' || name === 'notification' || name === 'ui'
|
||||
var portStream = new PortStream(remotePort)
|
||||
if (isMetaMaskInternalProcess) {
|
||||
// communication with popup
|
||||
|
33
app/scripts/send-token.js
Normal file
33
app/scripts/send-token.js
Normal file
@ -0,0 +1,33 @@
|
||||
const startPopup = require('./popup-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
|
||||
}
|
11
app/send-token.html
Normal file
11
app/send-token.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>MetaMask Plugin</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app-content"></div>
|
||||
<script src="./scripts/send-token.js" type="text/javascript" charset="utf-8"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user