Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

paperglider

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paperglider

Minimal library for common communication tasks between different window objects

latest
Source
npmnpm
Version
2.1.1
Version published
Maintainers
1
Created
Source

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.

Keywords

iframe

FAQs

Package last updated on 06 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts