Skip to content

Commit 1e1836a

Browse files
authored
Merge pull request #80 from valentinoli/patch-3
Add support for Twitter `via` parameter
2 parents 9d5a473 + 220355c commit 1e1836a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/share.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,10 @@ navigator.share = navigator.share || (function () {
226226
reject('Invalid Params');
227227
}
228228

229-
const { title, url, fbId, hashtags, hashtag } = data;
230-
const configs = {
229+
const { title, url, fbId, hashtags, via } = data;
230+
const { title, url, fbId, hashtags, via, hashtag } = data;
231+
232+
const configs = {
231233
...{
232234
copy: true,
233235
print: true,
@@ -580,7 +582,7 @@ navigator.share = navigator.share || (function () {
580582
break;
581583
}
582584
case 'twitter': {
583-
window.open(`https://twitter.com/intent/tweet?text=${text}&url=${url}&hashtags=${hashtags || ''}`);
585+
window.open(`https://twitter.com/intent/tweet?text=${text}&url=${url}&hashtags=${hashtags || ''}&via=${via || ''}`);
584586
break;
585587
}
586588
case 'linkedin': {

0 commit comments

Comments
 (0)