Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent not receiving message #29

Open
finchi opened this issue Aug 20, 2020 · 0 comments
Open

Parent not receiving message #29

finchi opened this issue Aug 20, 2020 · 0 comments

Comments

@finchi
Copy link

finchi commented Aug 20, 2020

Hey, I'm not able to receive message on my parent

parent.html

<iframe id="content" src="child.html"></iframe>

parent.js

import 'seamless/build/seamless.parent'

$(document).ready(() => {
    let child = $("iframe#content").seamless();
    child.receive(function(data, event) {
        // Print out the data that was received.
        console.log(data);
    });
});

child.js

import 'seamless/build/seamless.child'

let parent = window.seamless.connect();

// Send a message
parent.send({
    myparam: 'This is anything you want it to be...'
});

The problem, as far as I can see, is that on the parent.receive the check if (data.__id && (data.__id === _self.id)) fails, because the data.__id is 0. Looks like the child doesn't get the parents ID on connect.

Any idea what I did wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant