Skip to content

Instantly share code, notes, and snippets.

@nparsons08 nparsons08/tweet.js
Created Jul 30, 2018

Embed
What would you like to do?
tweet(title, url) {
const getWindowOptions = function() {
const width = 500;
const height = 350;
const left = window.innerWidth / 2 - width / 2;
const top = window.innerHeight / 2 - height / 2;
return [
'resizable,scrollbars,status',
'height=' + height,
'width=' + width,
'left=' + left,
'top=' + top,
].join();
};
const shareUrl = `https://twitter.com/intent/tweet?url=${url}&text=${title}&hashtags=Winds`;
const win = window.open(shareUrl, 'Share on Twitter', getWindowOptions());
win.opener = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.