kea-window-values
v3.0.0
Published
Sync: `values.anything` with `window.whatever` onscroll & onresize
Downloads
35,309
Readme
kea-window-values
- Sync
window.whatever
withvalues.anything
. - Sync on window onscroll & onresize events.
Installation
import { windowValuesPlugin } from 'kea-window-values'
resetContext({
plugins: [windowValuesPlugin({ window: window })]
}),
Usage
kea({
windowValues: {
isSmallScreen: window => window.innerWidth < 640,
isRetina: window => window.devicePixelRatio > 2,
scrollBarWidth: window => window.innerWidth - window.body.clientWidth
}
})