iframe.io 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export default class IOF {
|
|
|
32
32
|
initiate(contentWindow: MessageEventSource, iframeOrigin: string): this;
|
|
33
33
|
listen(hostOrigin?: string): this;
|
|
34
34
|
fire(_event: string, payload?: MessageData['payload'], callback?: boolean): void;
|
|
35
|
-
emit(_event: string, payload?: MessageData['payload'], fn?:
|
|
35
|
+
emit(_event: string, payload?: MessageData['payload'], fn?: CallbackFunction): this;
|
|
36
36
|
on(_event: string, fn: Listener): this;
|
|
37
37
|
once(_event: string, fn: Listener): this;
|
|
38
38
|
off(_event: string, fn?: Listener): this;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -165,7 +165,7 @@ export default class IOF {
|
|
|
165
165
|
listeners.map( fn => payload ? fn( payload, callbackFn ) : fn( callbackFn ) )
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
emit( _event: string, payload?: MessageData['payload'], fn?:
|
|
168
|
+
emit( _event: string, payload?: MessageData['payload'], fn?: CallbackFunction ){
|
|
169
169
|
|
|
170
170
|
if( !this.peer.source )
|
|
171
171
|
throw new Error('No Connection initiated')
|
|
@@ -178,7 +178,7 @@ export default class IOF {
|
|
|
178
178
|
// Acknowledge/callback event listener
|
|
179
179
|
let hasCallback = false
|
|
180
180
|
if( typeof fn === 'function' ){
|
|
181
|
-
const callbackFunction = fn
|
|
181
|
+
const callbackFunction = fn
|
|
182
182
|
|
|
183
183
|
this.once( _event +'--@callback', ({ error, args }) => callbackFunction( error, ...args ) )
|
|
184
184
|
hasCallback = true
|