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

@onefootprint/postmate

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onefootprint/postmate - npm Package Compare versions

Comparing version 2.0.5 to 2.1.0

2

build/postmate.dev.js
/**
@onefootprint/postmate - A powerful, simple, promise-based postMessage library
@version v2.0.4
@version v2.1.0
@link https://github.com/dollarshaveclub/postmate

@@ -5,0 +5,0 @@ @author Jacob Kelley <jakie8@gmail.com>

/**
@onefootprint/postmate - A powerful, simple, promise-based postMessage library
@version v2.0.4
@version v2.1.0
@link https://github.com/dollarshaveclub/postmate

@@ -5,0 +5,0 @@ @author Jacob Kelley <jakie8@gmail.com>

/**
@onefootprint/postmate - A powerful, simple, promise-based postMessage library
@version v2.0.4
@version v2.1.0
@link https://github.com/dollarshaveclub/postmate

@@ -5,0 +5,0 @@ @author Jacob Kelley <jakie8@gmail.com>

/**
@onefootprint/postmate - A powerful, simple, promise-based postMessage library
@version v2.0.4
@version v2.1.0
@link https://github.com/dollarshaveclub/postmate

@@ -5,0 +5,0 @@ @author Jacob Kelley <jakie8@gmail.com>

@@ -6,3 +6,3 @@ {

},
"version": "2.0.5",
"version": "2.1.0",
"description": "A powerful, simple, promise-based postMessage library",

@@ -12,3 +12,3 @@ "main": "build/postmate.js",

"unpkg": "build/postmate.min.js",
"types": "index.d.ts",
"types": "src/index.d.ts",
"files": [

@@ -15,0 +15,0 @@ "build",

@@ -15,3 +15,3 @@ // Type definitions for postmate 1.5

static debug: boolean;
/**

@@ -21,3 +21,3 @@ * Replace the Promise API that Postmate uses. Default: window.Promise

static Promise: Promise<any>;
/**

@@ -29,5 +29,5 @@ * Initializes a new instance of Postmate

constructor(options: Postmate.PostmateOptions);
}
declare namespace Postmate {
}
declare namespace Postmate {
/**

@@ -37,28 +37,33 @@ * Options passed to the Postmate constructor

interface PostmateOptions {
/**
* An element to append the iFrame to. Default: document.body
*/
container?: HTMLElement | null | undefined;
/**
* An object literal to represent the default values of the child's model
*/
model?: any;
/**
* A URL to load in the iFrame. The origin of this URL will also be used for securing message transport
*/
url: string;
/**
* An Array to add classes to the iFrame. Useful for styling
*/
classListArray?: string[] | undefined;
/**
* A name which is used for the name attribute of the created iFrame
*/
name?: string | undefined;
/**
* An element to append the iFrame to. Default: document.body
*/
container?: HTMLElement | null | undefined;
/**
* An object literal to represent the default values of the child's model
*/
model?: any;
/**
* A URL to load in the iFrame. The origin of this URL will also be used for securing message transport
*/
url: string;
/**
* An Array to add classes to the iFrame. Useful for styling
*/
classListArray?: string[] | undefined;
/**
* A string with all the allow attributes for the iFrame
*/
allow?: string;
/**
* A name which is used for the name attribute of the created iFrame
*/
name?: string | undefined;
}
/**

@@ -68,37 +73,37 @@ * Composes an API to be used by the parent

interface ParentAPI {
/**
* The iFrame Element that the parent is communicating with
*/
frame: HTMLIFrameElement;
/**
* Retrieves a value by property name from the child's model object.
*
* @param key The string property to lookup in the child's model
* @returns child model property value
*/
get(key: string): Promise<any>;
/**
* Calls a function on the child's model
*
* @param key The string property to lookup in the child's model
* @param data The optional data to send to the child function
*/
call(key: string, data?: any): void;
/**
* Listen to a particular event from the child
*
* @param eventName the name of the event
* @param callback the event handler function
*/
on(eventName: string, callback: (data?: any) => void): void;
/**
* Removes the iFrame element and destroys any message event listeners
*/
destroy(): void;
/**
* The iFrame Element that the parent is communicating with
*/
frame: HTMLIFrameElement;
/**
* Retrieves a value by property name from the child's model object.
*
* @param key The string property to lookup in the child's model
* @returns child model property value
*/
get(key: string): Promise<any>;
/**
* Calls a function on the child's model
*
* @param key The string property to lookup in the child's model
* @param data The optional data to send to the child function
*/
call(key: string, data?: any): void;
/**
* Listen to a particular event from the child
*
* @param eventName the name of the event
* @param callback the event handler function
*/
on(eventName: string, callback: (data?: any) => void): void;
/**
* Removes the iFrame element and destroys any message event listeners
*/
destroy(): void;
}
/**

@@ -108,11 +113,11 @@ * Composes an API to be used by the child

interface ChildAPI {
/**
* Emits an event to the parent
*
* @param name the name of the event
* @param data event data
*/
emit(name: string, data?: any): void;
/**
* Emits an event to the parent
*
* @param name the name of the event
* @param data event data
*/
emit(name: string, data?: any): void;
}
/**

@@ -124,14 +129,15 @@ * This is written in the child page. Calling Postmate.Model initiates a handshake request listener from the

class Model extends Promise<ChildAPI> {
/**
* Initializes a new instance of Model
*
* @param model An object of gettable properties to expose to the parent. Value types may be anything
* accepted in postMessage. Promises may also be set as values or returned from functions. Default: {}
*/
constructor(model: any);
/**
* Initializes a new instance of Model
*
* @param model An object of gettable properties to expose to the parent. Value types may be anything
* accepted in postMessage. Promises may also be set as values or returned from functions. Default: {}
*/
constructor(model: any);
}
}
declare module "@onefootprint/postmate" {
}
declare module '@onefootprint/postmate' {
export = Postmate;
}
}
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