@alessiofrittoli/web-utils
Version:
Common TypeScript web utilities
1 lines • 572 B
JavaScript
;var urlUtils=require('@alessiofrittoli/url-utils');var i=e=>new Map(e);var x=(e={})=>{let n=Math.max(100,e.width||600),o=Math.max(100,e.height||800),{url:t,context:s}=e,{features:a={}}=e,{left:d=window.screen.width/2-(n/2+10),top:u=window.screen.height/2-(o/2+50),...h}=a,p=i([["popup","yes"],["width",n.toString()],["height",o.toString()],["left",d.toString()],["top",u.toString()]]);Object.entries(h).map(([r,T])=>{p.set(r,T);});let y=Array.from(p).map(r=>r.join("=")).join(",");return window.open(t&&urlUtils.Url.format(t),s,y)};exports.openBrowserPopUp=x;