https://github.com/keajs/kea-window-values
Sync `window.whatever` with `values.anything`
https://github.com/keajs/kea-window-values
Last synced: about 1 month ago
JSON representation
Sync `window.whatever` with `values.anything`
- Host: GitHub
- URL: https://github.com/keajs/kea-window-values
- Owner: keajs
- License: mit
- Created: 2020-06-28T21:57:34.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-05T11:20:47.000Z (about 2 years ago)
- Last Synced: 2025-03-18T07:07:21.796Z (2 months ago)
- Language: TypeScript
- Size: 1.6 MB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/kea-window-values)
[](https://bundlephobia.com/result?p=kea-window-values)
[](https://bundlephobia.com/result?p=kea-window-values)
[](#backers)
[](#sponsors)# kea-window-values
- Sync `window.whatever` with `values.anything`.
- Sync on window onscroll & onresize events.## Installation
```javascript
import { windowValuesPlugin } from 'kea-window-values'resetContext({
plugins: [windowValuesPlugin({ window: window })]
}),
```## Usage
```javascript
kea({
windowValues: {
isSmallScreen: window => window.innerWidth < 640,
isRetina: window => window.devicePixelRatio > 2,
scrollBarWidth: window => window.innerWidth - window.body.clientWidth
}
})
```## Sample usage
[Read the documentation](https://keajs.org/docs/plugins/window-values)