Skip to content

Instantly share code, notes, and snippets.

@andreastt
Last active October 16, 2018 12:20
Show Gist options
  • Save andreastt/749ac49ba4836a7d8fa1369b80a822b9 to your computer and use it in GitHub Desktop.
Save andreastt/749ac49ba4836a7d8fa1369b80a822b9 to your computer and use it in GitHub Desktop.
async function restoreWindow(window) {
let cb;
await new TimedPromise(resolve => {
cb = new DebounceCallback(resolve);
window.addEventListener("sizemodechange", cb);
window.fullScreen = false;
});
window.removeEventListener("sizemodechange", cb);
}
async function restoreFullscreen(window) {
let cb;
await new TimedPromise(resolve => {
cb = () => {
if (WindowState.from(window.windowState) == WindowState.Normal) {
resolve();
}
};
window.addEventListener("sizemodechange", cb);
window.fullScreen = false;
});
window.removeEventListener("sizemodechange", cb);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment