Skip to content

Add Web Share types #837

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

Merged
merged 1 commit into from
Mar 20, 2020
Merged

Add Web Share types #837

merged 1 commit into from
Mar 20, 2020

Conversation

saschanaz
Copy link
Contributor

@saschanaz saschanaz requested a review from sandersn as a code owner March 20, 2020 19:33
@orta
Copy link
Contributor

orta commented Mar 20, 2020

Thanks @saschanaz

@orta orta merged commit 259df3f into microsoft:master Mar 20, 2020
@saschanaz saschanaz deleted the webshare branch March 20, 2020 19:42
@Artur-
Copy link

Artur- commented Oct 13, 2020

The suggestion in the linked issue suggests adding

interface Navigator {
  share?: NavigatorShare;
}

however this PR adds it as

interface Navigator {
  share: NavigatorShare;
}

As share is not available in most browsers, you want to check for the existence of it before using it but

if (navigator.share) {

now results in an error

This condition will always return true since the function is always defined. Did you mean to call it instead? ts(2774)

@samtgarson
Copy link

@orta This comment 👆 seems correct, is there a reason share is always defined here?

@orta
Copy link
Contributor

orta commented Mar 28, 2021

That is how the w3c spec defines it- you're welcome to send a PR making it optional 👍🏻

@ferm10n
Copy link

ferm10n commented Sep 6, 2021

any reason why canShare wasn't added as well?

@saschanaz
Copy link
Contributor Author

It's added later by #1125.

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.

DOM lib: add support for navigator.share
5 participants