Skip to content

Instantly share code, notes, and snippets.

@du5rte
Created September 18, 2018 12:42
Show Gist options
  • Save du5rte/fce95b846c33905c83316b4c172605b0 to your computer and use it in GitHub Desktop.
Save du5rte/fce95b846c33905c83316b4c172605b0 to your computer and use it in GitHub Desktop.
Pop up
export default function popup(url, {name='', width=500, height=500}={}) {
// References
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
let options = `
width=${width},
height=${height},
left=${window.screenX + ((window.outerWidth - width) / 2)},
top=${window.screenY + ((window.outerHeight - height) / 2)}
`
window.open(url, name, options)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment