2.1.1 • Published 4 years ago

paperglider v2.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

paperglider

Minimal library for common communication tasks between different window objects.

Installation

npm install paperglider

The PaperGlider class can be included via AMD, commonjs or a script tag.

Example

We assume a main frame with origin http://main.example.com and a child frame with origin http://child.example.com.

Main frame:

    const PaperGlider = require('paperglider');
    
    const com = PaperGlider.connectIframe(iframe, 'http://child.example.com');

    com.replyOn('someaction', (a, b) => a === b);

Now everytime the paperglider object in the main frame receives a message with the action 'someaction' with the proper targetOrigin, it responds by comparing both sent parameters.

Child frame:

    const PaperGlider = require('paperglider');
    
    const com = PaperGlider.connectParent('http://main.example.com');

    com.request('someaction', [2, 2], result => console.log(result));

More complete examples can be found in the examples folder. The files iframe.html and window-open.html can both be opened locally.

Documentation

An Api documentation lives the file APIDOC.md in this repository.

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago