You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Check if the Web Share API is being supported by the browser
if (navigator.share) {
navigator.share({
title: 'JS snippets, tips and data structures and whatnot libraries too!! @ one place',
text: 'Javascript tips, snippets, and Data Structure will be posted. Anyone interested in sharing their knowledge in this publication, you are welcome!',
url: 'https://medium.com/awesome-javascript'
})
.then(() => console.log('Share was successful.'))
.catch((error) => {
// You application logic if the share is cancelled by the user or fails
console.log('Sharing failed', error)
});
} else {
// Browser doens't have the support to use the native share functionality
// Can use this block as fallback method to show your preferable sharing options