Skip to content

Clarifying behavior of multiple simultaneous shares #110

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

Closed
marcoscaceres opened this issue Jul 2, 2019 · 0 comments · Fixed by #113
Closed

Clarifying behavior of multiple simultaneous shares #110

marcoscaceres opened this issue Jul 2, 2019 · 0 comments · Fixed by #113

Comments

@marcoscaceres
Copy link
Member

We probably want to clarify what happens when multiple concurrent shares are triggered by user activation. Consider:

var b = document.createElement("button");
document.body.appendChild(b);
b.innerHTML = "hello!";
b.onclick = () => {
    var  p1 =  navigator.share({text: "i am 1", title: "i am 1"});
    var  p2 =  navigator.share({text: "i am 2", title: "i am 2"});
    p1.then(()=>console.log("1 resolved")).catch(err =>  console.error(1, err));
    p2.then(()=>console.log("2 resolved")).catch(err =>  console.error(2, err));
}

Should p1 win and p2 automatically gets rejected with an AbortError? or should p1 get rejected, and p2 wins?

Safari currently shares p1, but rejects both with AbortErrors (even though the share is successful). That seems like a bug.

In any case, seems like if p1 should win and trying to make subsequent calls to share() should reject with an InvalidStateError (i.e., only allow one share at a time per document).

@marcoscaceres marcoscaceres changed the title Clarifying behavior of multiple simulations shares Clarifying behavior of multiple simultaneous shares Jul 2, 2019
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 a pull request may close this issue.

1 participant