shareFile helper function
Mon May 31 2021 19:11:24 GMT+0000 (Coordinated Universal Time)
Saved by
@kushsingh
const shareFile = (file, title, text) => {
if (navigator.canShare && navigator.canShare({ files: [file] })) {
navigator
.share({
files: [file],
title,
text
})
.then(() => console.log("Share was successful."))
.catch((error) => console.log("Sharing failed", error));
} else {
console.log(`Your system doesn't support sharing files.`);
}
};
content_copyCOPY
Comments