Last active
June 14, 2019 13:31
-
-
Save cahilfoley/849805a6e0c4e3d71619f278e495f105 to your computer and use it in GitHub Desktop.
[Browser Utilities] Random utility functions that are useful when working in the browser #browser
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
/** | |
* Gets the height and width of the provided HTML element | |
* @param element The html element to measure | |
*/ | |
export function getSize(element?: HTMLElement) { | |
if (!element) return { height: 0, width: 0 } | |
return { | |
height: element.offsetHeight, | |
width: element.offsetWidth, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment