web-social-share
Version:
A Web Component to share urls and text on social networks
16 lines (15 loc) • 504 B
JavaScript
// Same implementation as in class @deckdeckgo/utils
export const isMobile = () => {
return window === null || window === void 0 ? void 0 : window.matchMedia('(any-pointer:coarse)').matches;
};
export const staticOpenNewWindow = (urlString) => {
if (window.self !== window.top) {
window.open(urlString, '_blank');
}
else {
window.open(urlString, '_self');
}
};
export const shareEncodedUrl = (socialShareUrl) => {
return encodeURIComponent(socialShareUrl || window.location.href);
};