web-social-share
Version:
A Web Component to share urls and text on social networks
12 lines (11 loc) • 524 B
JavaScript
import { openNewWindow, shareEncodedUrl } from "../utils/utils";
export const hackernews = async ({ socialShareUrl, socialShareText, openWindowTarget: target }) => {
let urlString = 'https://news.ycombinator.com/submitlink?u=';
//default to the current page if a URL isn't specified
urlString += shareEncodedUrl(socialShareUrl);
if (socialShareText) {
urlString += '&t=' + encodeURIComponent(socialShareText);
}
openNewWindow({ urlString, target });
};
//# sourceMappingURL=hackernews.js.map