UNPKG

react-custom-share

Version:
36 lines (30 loc) 942 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); function windowOpen(url) { var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 650; var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 450; var left = window.outerWidth / 2 + (window.screenX || window.screenLeft || 0) - width / 2; var top = window.outerHeight / 2 + (window.screenY || window.screenTop || 0) - height / 2; var config = { height: height, width: width, left: left, top: top, location: 'no', toolbar: 'no', status: 'no', directories: 'no', menubar: 'no', scrollbars: 'yes', resizable: 'no', centerscreen: 'yes', chrome: 'yes' }; var shareDialog = window.open(url, 'share', Object.keys(config).map(function (key) { return key + '=' + config[key]; }).join(',')); return shareDialog; } exports.default = windowOpen;