Created
December 17, 2019 07:27
-
-
Save itsabdessalam/48c95df811b573d04023608dbbdf20cf to your computer and use it in GitHub Desktop.
getTopWindow - helper to retrieve the topmost window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper to retrieve the topmost window | |
*/ | |
export const getTopWindow = () => { | |
let w = window; | |
if (window.top) w = window.top; | |
else | |
while (w.parent) { | |
w = w.parent; | |
} | |
return w; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment