Skip to content

Commit

Permalink
prevent undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxodin committed Nov 17, 2023
1 parent d3f0bd6 commit 086607c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions polyfills/navigator/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ const share = async function(data){
},200);
}

const buildText = (...parts) => parts.filter(Boolean).join('\n\n');
const payload = {
title: enc(data.title),
text: enc(data.text),
url: enc(data.url),
titleText: enc(data.title+'\n\n'+data.text),
titleTextUrl: enc(data.title+'\n\n'+data.text+'\n\n'+data.url),
textUrl: enc(data.text+'\n\n'+data.url),
titleText: enc(buildText(data.title, data.text)+'\n'),
titleTextUrl: enc(buildText(data.title, data.text, data.url)+'\n'),
textUrl: enc(buildText(data.text, data.url)+'\n'),
}

document.body.append(dialog);
dialog.showModal();
dialog.classList.add('-Open');
Expand Down

0 comments on commit 086607c

Please sign in to comment.