@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
48 lines (47 loc) • 1.99 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var ESLShareMediaAction_1;
import { ESLShareUrlGenericAction } from './url-generic-action';
/**
* Share using nested window with social media url {@link ESLShareBaseAction} implementation.
* Applicable to the most of social media (e.g. Twitter, Facebook, LinkedIn, etc.)
*/
let ESLShareMediaAction = ESLShareMediaAction_1 = class ESLShareMediaAction extends ESLShareUrlGenericAction {
get windowFeatures() {
const features = this.constructor.FEATURES;
return Object.entries(features).map(([key, value]) => `${key}=${value}`).join(',');
}
/** Does an action to share */
share($button) {
const { shareLink } = $button;
if (!shareLink)
return;
const shareData = this.getShareData($button);
window.open(this.buildURL(shareLink, shareData), '_blank', this.windowFeatures);
}
};
ESLShareMediaAction.is = 'media';
/**
* Window features that are applicable to window.open()
* include options such as the default size and position of the window,
* whether to open a minimal popup window, and more.
* */
ESLShareMediaAction.FEATURES = {
scrollbars: 0,
resizable: 1,
menubar: 0,
left: 100,
top: 100,
width: 750,
height: 500,
toolbar: 0,
status: 0
};
ESLShareMediaAction = ESLShareMediaAction_1 = __decorate([
ESLShareUrlGenericAction.register
], ESLShareMediaAction);
export { ESLShareMediaAction };