Skip to content

Instantly share code, notes, and snippets.

@du5rte
Created Sep 18, 2018
Embed
What would you like to do?
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