Skip to content

Explain why canShare exists at definition. #159

Closed
@scheib

Description

@scheib

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'.

If share() is present, there is a reasonable expectation that it will work and present the user with at least one share target. Clients can use the presence or absence of this method to determine whether to show UI that triggers its use.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions