Skip to content

Commit

Permalink
docs: add customize usage
Browse files Browse the repository at this point in the history
  • Loading branch information
byronogis committed Dec 4, 2024
1 parent b9cb352 commit bdd24b6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,27 @@ timer.clear()

<!-- /automd -->

## Advanced Usage

Customize the timeout/interval power, like using [worker-timers](https://github.com/chrisguttandin/worker-timers)(A replacement for setInterval() and setTimeout() which works in unfocused windows.):

```ts
import { pausableTimers } from 'pausable-timers'
import { clearInterval, clearTimeout, setInterval, setTimeout } from 'worker-timers'

const timer = pausableTimers(() => {
/**
* Execute after 1 second
* 1s 后执行
*/
}, 1000, {
setTimeout,
setInterval,
clearTimeout,
clearInterval,
})
```

<!-- automd:fetch url="gh:byronogis/.github/main/snippets/readme-contrib-node-pnpm.md" -->

## Contribution
Expand Down

0 comments on commit bdd24b6

Please sign in to comment.