Skip to content

Commit

Permalink
Pushing handshake request to the end of the call stack
Browse files Browse the repository at this point in the history
  • Loading branch information
jakiestfu committed Oct 24, 2016
1 parent 7ba8ccd commit 040dffc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build/postmate.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postmate",
"version": "1.1.3",
"version": "1.1.4",
"description": "A powerful, simple, promise-based postMessage library",
"main": "build/postmate.min.js",
"files": [
Expand Down
9 changes: 4 additions & 5 deletions src/postmate.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,13 @@ class Postmate {

this.parent.addEventListener('message', reply, false);


const loaded = () => {
log('Parent: Sending handshake');
this.child.postMessage({
log('Parent: Sending handshake', { childOrigin });
setTimeout(() => this.child.postMessage({
postmate: 'handshake',
type: MESSAGE_TYPE,
model: this.model,
}, childOrigin);
}, childOrigin), 0);
};

if (this.frame.attachEvent){
Expand All @@ -280,7 +279,7 @@ class Postmate {
this.frame.onload = loaded;
}

log('Parent: Loading frame');
log('Parent: Loading frame', { url });
this.frame.src = url;
});
}
Expand Down

0 comments on commit 040dffc

Please sign in to comment.