├── .cz.json ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── other.md └── workflows │ └── on_push.yml ├── .gitignore ├── .npmignore ├── .run ├── Commit.run.xml ├── Prettier check.run.xml ├── Prettier write.run.xml ├── Run Integration Tests.run.xml └── Run Unit Tests.run.xml ├── .versionrc.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── docs ├── _assets │ └── css │ │ └── style.scss ├── _config.yml ├── boilerplate.md ├── callbacks │ ├── index.md │ ├── useAnimationFrame.md │ ├── useDebounce.md │ ├── useIdleCallback.md │ ├── useThrottle.md │ └── useTimeout.md ├── effects │ ├── index.md │ ├── useIdleCallbackEffect.md │ └── useTimeoutEffect.md ├── index.md ├── list-of-all-hooks │ └── index.md ├── loops-and-intervals │ ├── index.md │ ├── useAnimationFrameLoop.md │ ├── useClock.md │ ├── useCountdown.md │ ├── useCounter.md │ ├── useInterval.md │ ├── useOscillator.md │ └── useTimer.md ├── migrations │ ├── index.md │ ├── v1v2.md │ ├── v2v3.md │ ├── v3v4.md │ └── v4v5.md └── state │ ├── index.md │ └── useThrottledState.md ├── integration-tests ├── helpers.ts ├── useAnimationFrame.test.tsx ├── useAnimationFrameLoop.test.tsx ├── useClock.test.tsx ├── useCountdown.test.tsx ├── useDebounce.test.tsx ├── useIdleCallback.test.tsx ├── useIdleCallbackEffect.test.tsx ├── useInterval.test.tsx ├── useOscillator.test.tsx ├── useThrottledState.test.tsx ├── useTimeout.test.tsx ├── useTimeoutEffect.test.tsx └── useTimer.test.tsx ├── jest.config.js ├── jest.setup.js ├── logo.png ├── package-lock.json ├── package.json ├── prettier.config.js ├── rollup.config.js ├── rollup.config.prod.js ├── src ├── animation-frame │ ├── types.ts │ ├── useAnimationFrame.test.ts │ ├── useAnimationFrame.ts │ ├── useAnimationFrameLoop.test.ts │ └── useAnimationFrameLoop.ts ├── controls │ ├── useControls.test.ts │ └── useControls.ts ├── general-utility │ └── useThrottledState.ts ├── idle-callback │ ├── types.ts │ ├── useIdleCallback.test.ts │ ├── useIdleCallback.ts │ ├── useIdleCallbackEffect.test.ts │ └── useIdleCallbackEffect.ts ├── index.ts ├── interval │ ├── useClock.test.ts │ ├── useClock.ts │ ├── useCountdown.test.ts │ ├── useCountdown.ts │ ├── useCounter.test.ts │ ├── useCounter.ts │ ├── useInterval.test.ts │ ├── useInterval.ts │ ├── useOscillator.test.ts │ ├── useOscillator.ts │ ├── useTimer.test.ts │ └── useTimer.ts ├── testing │ └── advanceTimersUsingAct.ts ├── timeout │ ├── types.ts │ ├── useDebounce.test.ts │ ├── useDebounce.ts │ ├── useThrottle.test.ts │ ├── useThrottle.ts │ ├── useTimeout.test.ts │ ├── useTimeout.ts │ ├── useTimeoutEffect.test.ts │ └── useTimeoutEffect.ts └── util │ └── logging.ts └── tsconfig.json /.cz.json: -------------------------------------------------------------------------------- 1 | { 2 | "path": "node_modules/emoji-cz", 3 | "emoji-cz": { 4 | "types": { 5 | "Fix": { 6 | "name": "fix" 7 | }, 8 | "Feat": { 9 | "name": "feat" 10 | }, 11 | "Docs": { 12 | "name": "docs", 13 | "emoji": "📝" 14 | }, 15 | "Style": { 16 | "name": "style", 17 | "description": "White-space, formatting, missing semi-colons..." 18 | }, 19 | "Refactor": { 20 | "emoji": "♻️", 21 | "name": "refactor" 22 | }, 23 | "Perf": { 24 | "emoji": "⚡", 25 | "name": "perf" 26 | }, 27 | "Test": { 28 | "emoji": "🚨", 29 | "description": "Adding missing tests or correcting existing tests", 30 | "name": "test" 31 | }, 32 | "Chore": { 33 | "emoji": "🔧", 34 | "name": "chore", 35 | "description": "Auxiliary tool changes, configs, dev-ops etc." 36 | }, 37 | "CI": { 38 | "emoji": "🚀", 39 | "name": "ci", 40 | "description": "Changes to the build pipeline" 41 | } 42 | }, 43 | "format": "[name]: [emoji] [subject]" 44 | } 45 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | charset=utf-8 3 | insert_final_newline=true 4 | indent_style=space 5 | indent_size=2 6 | tab_width=2 7 | 8 | [*.{js,ts}] 9 | indent_style=space 10 | tab_width=2 11 | ij_javascript_force_semicolon_style = false 12 | ij_javascript_use_semicolon_after_statement = false 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: EricLambrecht 7 | 8 | --- 9 | 10 | **Bug Description:** 11 | A clear and concise description of the bug / problem / issue. 12 | 13 | **To Reproduce:** 14 | Steps to reproduce the buggy behavior. A code example would be very helpful. 15 | 16 | **Expected behavior:** 17 | A clear and concise description of what you expected to happen instead. 18 | 19 | **Screenshots:** 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **System:** 23 | - Node Version: [e.g. 16.13.2 LTS] 24 | - OS: [e.g. macOS] 25 | - Browser? [e.g. chrome 67, safari 12] 26 | 27 | **Additional context:** 28 | Add any other context about the problem here. 29 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Status Quo / Problem / Topic** 11 | Description of the status quo / a problem / a thing that needs improvement in your opinion. 12 | 13 | **Solution** 14 | A clear and concise description of a possible solution or what you want to happen. Code examples are welcome. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other 3 | about: Anything that is not bug or feature related 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/workflows/on_push.yml: -------------------------------------------------------------------------------- 1 | name: React Timing Hooks – Build & Test 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | build: 6 | name: ${{ matrix.os }}, Node ${{ matrix.node-version }} 7 | runs-on: ${{ matrix.os }} 8 | 9 | strategy: 10 | matrix: 11 | os: [macos-latest, windows-latest, ubuntu-latest] 12 | node-version: [16.x, 18.x, 20.x] 13 | 14 | steps: 15 | - uses: actions/checkout@v1 16 | - name: Setup Node ${{ matrix.node-version }} on ${{ matrix.os }} 17 | uses: actions/setup-node@v1 18 | with: 19 | node-version: ${{ matrix.node-version }} 20 | - name: npm install 21 | run: npm ci 22 | - name: install locales for integration tests 23 | run: | 24 | npm install -g full-icu 25 | echo "NODE_ICU_DATA=`node-full-icu-path 2>/dev/null`" >> $GITHUB_ENV 26 | shell: bash 27 | - name: Lint and unit tests 28 | run: | 29 | npm run prettier:check 30 | npm run test:unit 31 | - name: Coveralls.io Test Coverage 32 | uses: coverallsapp/github-action@master 33 | with: 34 | github-token: ${{ secrets.GITHUB_TOKEN }} 35 | flag-name: run-${{ matrix.node-version }}-on-${{ matrix.os }} 36 | parallel: true 37 | - name: Integration tests 38 | run: | 39 | npm run build --if-present 40 | npm run test:integration 41 | env: 42 | CI: true 43 | 44 | finish: 45 | needs: build 46 | runs-on: ubuntu-latest 47 | steps: 48 | - name: Coveralls Finished 49 | uses: coverallsapp/github-action@master 50 | with: 51 | github-token: ${{ secrets.github_token }} 52 | parallel-finished: true 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Exclude JetBrains dir 2 | .idea/ 3 | 4 | # dist folder 5 | dist/ 6 | .tmp/ 7 | 8 | # Created by .ignore support plugin (hsz.mobi) 9 | ### Node template 10 | # Logs 11 | logs 12 | *.log 13 | npm-debug.log* 14 | yarn-debug.log* 15 | yarn-error.log* 16 | lerna-debug.log* 17 | 18 | # Diagnostic reports (https://nodejs.org/api/report.html) 19 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 20 | 21 | # Runtime data 22 | pids 23 | *.pid 24 | *.seed 25 | *.pid.lock 26 | 27 | # Directory for instrumented libs generated by jscoverage/JSCover 28 | lib-cov 29 | 30 | # Coverage directory used by tools like istanbul 31 | coverage 32 | *.lcov 33 | 34 | # nyc test coverage 35 | .nyc_output 36 | 37 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 38 | .grunt 39 | 40 | # Bower dependency directory (https://bower.io/) 41 | bower_components 42 | 43 | # node-waf configuration 44 | .lock-wscript 45 | 46 | # Compiled binary addons (https://nodejs.org/api/addons.html) 47 | build/Release 48 | 49 | # Dependency directories 50 | node_modules/ 51 | jspm_packages/ 52 | 53 | # TypeScript v1 declaration files 54 | typings/ 55 | 56 | # TypeScript cache 57 | *.tsbuildinfo 58 | 59 | # Optional npm cache directory 60 | .npm 61 | 62 | # Optional eslint cache 63 | .eslintcache 64 | 65 | # Optional REPL history 66 | .node_repl_history 67 | 68 | # Output of 'npm pack' 69 | *.tgz 70 | 71 | # Yarn Integrity file 72 | .yarn-integrity 73 | 74 | # dotenv environment variables file 75 | .env 76 | .env.test 77 | 78 | # parcel-bundler cache (https://parceljs.org/) 79 | .cache 80 | 81 | # next.js build output 82 | .next 83 | 84 | # nuxt.js build output 85 | .nuxt 86 | 87 | # vuepress build output 88 | .vuepress/dist 89 | 90 | # Serverless directories 91 | .serverless/ 92 | 93 | # FuseBox cache 94 | .fusebox/ 95 | 96 | # DynamoDB Local files 97 | .dynamodb/ 98 | 99 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .* 2 | **/tsconfig.json 3 | **/prettier.config.js 4 | **/jest.config.js 5 | **/jest.setup.js 6 | **/rollup.config.js 7 | **/rollup.config.prod.js 8 | _* 9 | 10 | CODE_OF_CONDUCT.md 11 | CONTRIBUTING.md 12 | CHANGELOG.md 13 | 14 | .tmp 15 | coverage 16 | node_modules 17 | docs 18 | src 19 | integration-tests 20 | logo.png 21 | -------------------------------------------------------------------------------- /.run/Commit.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |