-
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
Explain why canShare exists at definition. #159
Comments
Another motivation was version detection. For example, early implementations have no support for file sharing. A web app might want to hide or disable a "Share" button on user agents that do not support file sharing. |
Thank you. I'm sorry that as a reader I see https://github.com/w3c/web-share/pull/177/files adding a definition of the algorithm and behavior, but not the explanation of why canShare exists or the motivation to use it instead of share. |
Thank you, this resolves the issue well! |
It's an unusual pattern to see .foo() and canFoo(). The specification would benefit from text or a note explaining why the canShare method exists. (As would all downstream documentation).
From a brief bit of research reading spec, MDN, and a few 'how to' articles, it isn't clear why web developers should go through the extra machinations. Perhaps it is explained, but not near the definition. There is, however, a note discussing feature detecting 'share'.
Perhaps canShare is to enable an optimization to not prepare data for sharing until we know if it is possible. Likely many developers will prefer the code simplicity of feature detecting .share() and attempting the share. This optimization doesn't seem necessary for many applications. If there's a reason that wouldn't be a good idea, or if it specifically wouldn't work, the specification should explain why.
The text was updated successfully, but these errors were encountered: