0.1.1 • Published 3 years ago
@daocasino/platform-messaging v0.1.1
Iframe messaging
This library allows you to wrap your classes and use them over iframe
Usage
- Wrap your class in parent window
const iframeMessagingProvider = await IframeMessagingProvider.create('parent', 'child-iframe')
iframeMessagingProvider.exposeService('MyService', new MyServiceClass())
- 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