aboutsummaryrefslogtreecommitdiffstats
path: root/library/lib/setup-iframe.js
blob: 0aa001dcf67d7d7fb93669a96b4c49353a8e703e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const Iframe = require('iframe')
const IframeStream = require('iframe-stream').IframeStream

module.exports = setupIframe


function setupIframe(opts) {
  debugger
  opts = opts || {}
  var frame = Iframe({
    src: opts.zeroClientProvider || 'https://zero.metamask.io/',
    container: opts.container || document.head,
    sandboxAttributes: opts.sandboxAttributes || ['allow-scripts', 'allow-popups'],
  })
  var iframe = frame.iframe
  iframe.style.setProperty('display', 'none')
  var iframeStream = new IframeStream(iframe)

  return iframeStream
}