Skip to content

Commit

Permalink
Renamed function name to be a little clearer around it being a CSS va…
Browse files Browse the repository at this point in the history
…riable helper
  • Loading branch information
fuzzypawzz committed Dec 23, 2023
1 parent 72e5281 commit 256f9b7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/JMDK.UI/infrastructure/helpers/browser/window-height.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const WINDOW_HEIGHT_CSS_VAR = '--window-height'

export function useWindowHeightVariable() {
function setWindowHeightVariable() {
export function useWindowHeightCssVariable() {
function setWindowHeightCssVariable() {
document.documentElement.style.setProperty(
WINDOW_HEIGHT_CSS_VAR,
`${window.innerHeight / 100}px`,
)
}

setWindowHeightVariable()
window.addEventListener('resize', setWindowHeightVariable)
window.addEventListener('orientationchange', setWindowHeightVariable)
setWindowHeightCssVariable()
window.addEventListener('resize', setWindowHeightCssVariable)
window.addEventListener('orientationchange', setWindowHeightCssVariable)

return function dispose() {
window.removeEventListener('resize', setWindowHeightVariable)
window.removeEventListener('orientationchange', setWindowHeightVariable)
window.removeEventListener('resize', setWindowHeightCssVariable)
window.removeEventListener('orientationchange', setWindowHeightCssVariable)
}
}

0 comments on commit 256f9b7

Please sign in to comment.