blob: 2e50ae3a540ab6756818004a49ac2bdad0a9cf7c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
const web3 = require('web3')
// inject script tag
var scriptTag = document.createElement('script')
scriptTag.src = chrome.extension.getURL('scripts/web3.js')
scriptTag.onload = function() { debugger; this.parentNode.removeChild(this) }
var container = document.head || document.documentElement
container.appendChild(scriptTag)
// listen for messages
var port = chrome.runtime.connect({name: 'metamask'})
port.postMessage({joke: 'Knock knock'})
port.onMessage.addListener(function(msg) {
console.log(msg)
// port.postMessage({answer: 'Madame'})
})
|