0.7.8 • Published 2 years ago

@ringcentral/web-apps-sync-iframe v0.7.8

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

RingCentral Web Apps Sync IFRAME

This library can be used to synchronize parent frame and the IFRAME:

  • URL of parent frame and IFRAME
  • IFRAME size will be set according to it's content
  • CustomEvents on the IFRAME DOM node will be transmitted to and from the page inside IFRAME

Usage: IFRAME part

import {IFrameSync} from "@ringcentral/web-apps-sync/lib/iframe";
import {makeEvent, eventType} from "@ringcentral/web-apps-common";

const iframeSync = new IFrameSync({
    history: 'html5', // also can be hash or custom history object
    sendInitialLocation: true // will trigger location event once created
});

iframeSync.getEventTarget().addEventListener(eventType.message, data => console.log(data));
iframeSync.getEventTarget().dispatchEvent(makeEvent(eventType.message, {foo: 'bar'}));

For react applications to simplify link between Sync and History follow this pattern:

import {createBrowserHistory} from 'history';
import {Router} from 'react-router-dom';

const history = createBrowserHistory();

const iframeSync = new IFrameSync({history});

export defult <Router history={history}>...</Router>;
0.7.8

2 years ago

0.7.7

2 years ago

0.7.6

2 years ago

0.7.5

4 years ago

0.7.4

4 years ago

0.7.3

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago