Skip to content

Latest commit

 

History

History
21 lines (19 loc) · 724 Bytes

README.md

File metadata and controls

21 lines (19 loc) · 724 Bytes

Iframe messaging

This library allows you to wrap your classes and use them over iframe

Usage

  1. Wrap your class in parent window
const iframeMessagingProvider = await IframeMessagingProvider.create('parent', 'child-iframe')
iframeMessagingProvider.exposeService('MyService', new MyServiceClass())
  1. Write client code in child window
const iframeMessagingProvider = await IframeMessagingProvider.create('child')
const myService = iframeMessagingProvider.getRemoteService<MyService>('MyService')

const result = await myService.anyMethod(param1, param2)

Don't forget to call stopService and destory for correctly close on window unload

Example

$ yarn start:example