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