UNPKG

@exadel/esl

Version:

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

24 lines (23 loc) 940 B
import { ESLShareActionRegistry } from './esl-share-action-registry'; /** Base action class/interface for actions that ESLShare widgets can invoke. */ export class ESLShareBaseAction { static register(action) { action = action || this; if (action === ESLShareBaseAction) throw new Error('`ESLShareBaseAction` can\'t be registered.'); if (!((action === null || action === void 0 ? void 0 : action.prototype) instanceof ESLShareBaseAction)) throw new Error('Action should be instanceof `ESLShareBaseAction`'); ESLShareActionRegistry.instance.register(action); } /** Checks if this action is available on the user's device */ get isAvailable() { return true; } /** @returns {@link ShareData} object for button */ getShareData($button) { return { url: $button.urlToShare, title: $button.titleToShare }; } }