UNPKG

@exadel/esl

Version:

Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components

22 lines (21 loc) 715 B
import { ESLShareBaseAction } from '../core/esl-share-action'; import { format } from '../../esl-utils/misc/format'; /** * Base {@link ESLShareBaseAction} implementation for actions, that use URL-based sharing mechanism */ export class ESLShareUrlGenericAction extends ESLShareBaseAction { getFormatSource(shareData) { const title = encodeURIComponent(shareData.title || ''); const url = encodeURIComponent(shareData.url || ''); return { u: url, t: title, url, title }; } /** Builds URL to share on a social network */ buildURL(link, shareData) { return format(link, this.getFormatSource(shareData)); } }