@onefootprint/postmate
Advanced tools
Comparing version 2.0.5 to 2.1.0
/** | ||
@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; | ||
} | ||
} | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75637
1744