feeles-ide
Version:
The hackable and serializable IDE to make learning material
19 lines • 558 B
JavaScript
export default function open(url, target, options) {
if (!target) {
target = '_blank';
}
if (!options) {
var width = 600;
var height = 520;
options = ['width=' + width, 'height=' + height, 'left=' + Math.round(screen.width / 2 - width / 2), 'top=' + (screen.height > width ? Math.round(screen.height / 2 - height / 2) : 0)].join();
}
var dialog = window.open(url, target, options);
if (dialog) {
window.addEventListener('unload', function () {
if (dialog) {
dialog.close();
}
});
}
return dialog;
}