-
Notifications
You must be signed in to change notification settings - Fork 65
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
Conditionally exposing share() is not great #59
Comments
This is not allowed by the spec. This clause is supposed to be a static decision that is compiled into the user agent; Some context:
A summary of the reasoning for removing it is:
if (!navigator.share)
return; to this: if (!navigator.share)
return;
if (navigator.canShare) {
// Assuming you use async; otherwise it's more complicated.
if (!(await navigator.canShare()))
return;
} It doesn't seem worth making developers do 3 checks, if Do other implementors (Firefox?) feel the need to dynamically enable/disable sharing as share targets become available or unavailable? |
Heh, I had a feeling we had discussed this. As you said, given that there is probably only going to always be one, then |
Spec says:
This doesn't seem great. A share target can be removed/added, etc. making this super weird if the API vanishes from one page load to the next.
What we should have a is static method a on Navigator, or just normal method even, as navigator is just a singleton:
The text was updated successfully, but these errors were encountered: