aboutsummaryrefslogblamecommitdiffstats
path: root/mascara/src/lib/setup-iframe.js
blob: dcf4045744540772a8ad23dcd919638a37c714b0 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                
                                                                







                                                                
                                               


                                                                                   
                                             
                                               


                     
const Iframe = require('iframe')
const createIframeStream = require('iframe-stream').IframeStream

module.exports = setupIframe


function setupIframe(opts) {
  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 = createIframeStream(iframe)

  return iframeStream
}