aboutsummaryrefslogtreecommitdiffstats
path: root/library/lib/setup-iframe.js
blob: dfb51c6766e33ddb534e7db09f0a040a499c2907 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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/',
    container: document.head,
    sandboxAttributes: opts.sandboxAttributes || ['allow-scripts', 'allow-popups'],
  })
  var iframe = frame.iframe
  var iframeStream = new IframeStream(iframe)

  return iframeStream
}