kea-window-values
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

NPM Version minified minified + gzipped Backers on Open Collective Sponsors on Open Collective

kea-window-values

  • Sync window.whatever with values.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
    }
  })

Sample usage

Read the documentation

Readme

Keywords

none

Package Sidebar

Install

npm i kea-window-values

Weekly Downloads

7,846

Version

3.0.0

License

MIT

Unpacked Size

40.1 kB

Total Files

12

Last publish

Collaborators

  • mariusandra