https://github.com/substrate-system/raf-scroll
Scroll events debounced with requestAnimationFrame
https://github.com/substrate-system/raf-scroll
Last synced: 10 months ago
JSON representation
Scroll events debounced with requestAnimationFrame
- Host: GitHub
- URL: https://github.com/substrate-system/raf-scroll
- Owner: substrate-system
- License: other
- Created: 2024-02-14T18:34:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-08T22:43:57.000Z (12 months ago)
- Last Synced: 2025-07-08T23:34:35.481Z (12 months ago)
- Language: TypeScript
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# raf scroll
[](https://github.com/substrate-system/raf-scroll/actions/workflows/nodejs.yml)
[](package.json)
[](README.md)
[](README.md)
[](https://packagephobia.com/result?p=@substrate-system/raf-scroll)
[](https://bundlephobia.com/package/@substrate-system/raf-scroll)
[](LICENSE)
Scroll events, debounced with `requestAnimationFrame`.
Contents
## Install
```sh
npm i -S @substrate-system/raf-scroll
```
## Example
```js
import { rafScroll } from '@substrate-system/raf-scroll'
rafScroll(ev => {
// this is called at most once per animation frame
console.log('scroll event', ev)
})
```
## Modules
This exposes ESM and common JS via [package.json `exports` field](https://nodejs.org/api/packages.html#exports).
### Bundler
Import like normal.
```js
import { rafScroll } from '@substrate-system/raf-scroll'
```
### Minified
This package exposes minified JS too. Copy to a location that is
accessible to your web server, then link to it in HTML.
#### copy
```sh
cp ./node_modules/@substrate-system/raf-scroll/dist/index.min.js ./public/raf-scroll.min.js
```
#### HTML
```html
```