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

More precise and cross-browser async method through postMessage #16

Closed
wants to merge 3 commits into from

Conversation

Panya
Copy link

@Panya Panya commented Oct 21, 2012

No description provided.

@wycats
Copy link
Contributor

wycats commented Oct 22, 2012

In at least one browser (IE8), postMessage is synchronous. I would like to use mutation observers if available, otherwise test for broken postMessage, otherwise use setTimeout. Want to update your patch with that strategy?

@Panya
Copy link
Author

Panya commented Oct 22, 2012

Yes. But I don't know any other browsers with synchronous postMessage.

@wycats
Copy link
Contributor

wycats commented Oct 22, 2012

@Panya Sure, but having rsvp.js fail to behave correctly in IE8 is a non-starter.

@Panya
Copy link
Author

Panya commented Oct 22, 2012

postMessageSupport returns false for IE8, because in IE8 document.documentMode <= 8.

@bengillies
Copy link

A better test would surely be something along the following lines:

function isPostMessageAsync() {
    var isAsync = true;

    if (!('postMessage' in window)) return false;

    function receiver() {
        isAsync = false;
    }

    window.addEventListener('message', receiver);
    window.postMessage(...);
    window.removeEventListener(receiver);

    return isAsync;
}

@tomdale
Copy link
Collaborator

tomdale commented Oct 26, 2012

@Panya Have you had a chance to take @bengillies suggestion into account?

@wagenet
Copy link
Contributor

wagenet commented Mar 27, 2013

@wycats, @tomdale, it looks like all the suggested changes were taken into account. That said, it no longer merges cleanly. Is this something we should try to get working?

@stefanpenner
Copy link
Collaborator

i am open to these additions, but this PR has been stale for some time so I will close this issue until someone resurrects.

@stefanpenner
Copy link
Collaborator

Although this is closed, postMessage does not appear stable and should be avoided. see: cujojs/when#197

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

Successfully merging this pull request may close these issues.

6 participants