web-social-share
Version:
A Web Component to share urls and text on social networks
10 lines (9 loc) • 582 B
JavaScript
// Same implementation as in class @deckdeckgo/utils
export const isMobile = () => {
const isTouchScreen = window.matchMedia('(any-pointer:coarse)').matches;
const isMouseScreen = window.matchMedia('(any-pointer:fine)').matches;
return isTouchScreen && !isMouseScreen;
};
export const openNewWindow = ({ urlString, target = '_blank' }) => window.open(urlString, target);
export const shareEncodedUrl = (socialShareUrl) => encodeURIComponent(socialShareUrl !== null && socialShareUrl !== void 0 ? socialShareUrl : window.location.href);
//# sourceMappingURL=utils.js.map