This package has been deprecated

Author message:

Renamed to @metamask/post-message-stream

post-message-stream
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/post-message-stream package

3.0.0 • Public • Published

post-message-stream

Sets up a duplex object stream over window.postMessage

var streamA = new PostMessageStream({
  name: 'thing one',
  target: 'thing two',
})
 
var streamB = new PostMessageStream({
  name: 'thing two',
  target: 'thing one',
})
 
streamB.on('data', (data) => console.log(data))
streamA.write(chunk)

constructor arguments

var messageStream = new PostMessageStream({
 
  // required
 
  // name of stream, used to differentiate
  // when multiple streams are on the same window 
  name: 'source',
 
  // name of target stream 
  target: 'sink',
 
  // optional
 
  // window to send the message to
  // default is `window`
  window: iframe.contentWindow,
  
})

Readme

Keywords

none

Package Sidebar

Install

npm i post-message-stream

Weekly Downloads

397

Version

3.0.0

License

ISC

Last publish

Collaborators

  • mcmire
  • nicholasellul
  • lgbot
  • naugtur
  • ritave
  • danfinlay
  • kumavis
  • rekmarks
  • metamaskbot
  • gudahtt
  • brad.decker
  • sethkfman