Skip to content

Add Web Share types#837

Merged
orta merged 1 commit into
microsoft:masterfrom
saschanaz:webshare
Mar 20, 2020
Merged

Add Web Share types#837
orta merged 1 commit into
microsoft:masterfrom
saschanaz:webshare

Conversation

@saschanaz
Copy link
Copy Markdown
Collaborator

@saschanaz saschanaz requested a review from sandersn as a code owner March 20, 2020 19:33
@orta
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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

@orta
Copy link
Copy Markdown
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
Copy Markdown

ferm10n commented Sep 6, 2021

any reason why canShare wasn't added as well?

@saschanaz
Copy link
Copy Markdown
Collaborator 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