2016-08-26 20:08:23 +02:00
|
|
|
const Iframe = require('iframe')
|
|
|
|
const IframeStream = require('iframe-stream').IframeStream
|
|
|
|
|
|
|
|
module.exports = setupIframe
|
|
|
|
|
|
|
|
|
|
|
|
function setupIframe(opts) {
|
|
|
|
opts = opts || {}
|
|
|
|
var frame = Iframe({
|
|
|
|
src: opts.zeroClientProvider || 'https://zero.metamask.io/',
|
2016-08-27 02:39:19 +02:00
|
|
|
container: opts.container || document.head,
|
2016-08-26 20:08:23 +02:00
|
|
|
sandboxAttributes: opts.sandboxAttributes || ['allow-scripts', 'allow-popups'],
|
|
|
|
})
|
|
|
|
var iframe = frame.iframe
|
2016-08-27 02:39:19 +02:00
|
|
|
iframe.style.setProperty('display', 'none')
|
2016-08-26 20:08:23 +02:00
|
|
|
var iframeStream = new IframeStream(iframe)
|
|
|
|
|
|
|
|
return iframeStream
|
|
|
|
}
|