Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postis

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postis

Lightweight wrapper around the PostMessage API

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.6K
increased by32.25%
Maintainers
4
Weekly downloads
 
Created
Source

Postis

Postis is a light wrapper around the PostMessage API

Installation

$ npm install --save postis

Usage

Parent HTML which contains an iframe:

var postis = require("postis");
var targetWindow = document.querySelectorAll("iframe")[0].contentWindow;

var channel = postis({
  window: targetWindow,
  scope: "scope-for-message-changing-to-avoid-overlapping"
});

channel.ready(function() {
  channel.listen("remoteMessageFromChild", function(remoteMessage) {
    console.log("remoteMessageFromChild:", remoteMessage);
  });

  channel.send({
    method: "remoteMessageFromParent",
    params: { awesome: "messsage",
              from: "Parent window"}
  });
});

In embedded child iframe:

var postis = require("postis");
var targetWindow = window.parent;

var channel = postis({
  window: targetWindow,
  scope: "scope-for-message-changing-to-avoid-overlapping"
});

channel.ready(function() {
  channel.listen("remoteMessageFromParent", function(remoteMessage) {
    console.log("remoteMessageFromParent:", remoteMessage);
  });

  channel.send({
    method: "remoteMessageFromChild",
    params: { awesome: "messsage",
              from: "child iframe"}
  });
});

Release

New releases are prepared in master after merging the PRs. Please include a meaningful changelog entry in PR.

Write a new CHANGELOG.md entry before running built-in npm version bump and add the change to next commit.

npm version <major | minor | patch>
git push --tags

npm version should include added changelog entry in the commit. Remember to push changes.

Keywords

FAQs

Package last updated on 01 Feb 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc