1.7.3 • Published 2 years ago

mini-iframe-rpc v1.7.3

Weekly downloads
50
License
Apache-2.0
Repository
github
Last release
2 years ago

mini-iframe-rpc

Simple Javascript library for postMessage-based inter iframe (or window) communication.

Installation

npm install --save mini-iframe-rpc

Building and testing

npm run build

Usage

If you want to establish communication between a parent window and it's child iframe, then in the parent, do:

<script src="mini_iframe_rpc.js"></script>
<script>
    const iframe = ...
    const rpc = mini_iframe_rpc();
    rpc.register('mySuperFunction', () => alert(1));
</script>

To call this code from the iframe, do:

<script src="mini_iframe_rpc.js"></script>
<script>
    const iframe = ...
    const rpc = mini_iframe_rpc();
    rpc.invoke(window.parent, "http://window-parent-location.com", 'mySuperFunction');
</script>

Packaging

Packaging is partly based on https://github.com/Hotell/typescript-lib-starter/

1.7.3

2 years ago

1.7.0

2 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.0

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago