Skip to content

Commit

Permalink
fix: this may be missing
Browse files Browse the repository at this point in the history
  • Loading branch information
molvqingtai committed Nov 30, 2024
1 parent 2aa6b54 commit 13819fa
Show file tree
Hide file tree
Showing 4 changed files with 505 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ SetTimeout is used by default, and custom adapters are supported, such as reques
```typescript
const timer = new Timer(log, {
adapter: {
setTimer: globalThis.requestAnimationFrame,
cancelTimer: globalThis.cancelAnimationFrame
setTimer: globalThis.requestAnimationFrame.bind(globalThis),
cancelTimer: globalThis.cancelAnimationFrame.bind(globalThis)
}
})
```
Expand Down
6 changes: 3 additions & 3 deletions __tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('Test timer', () => {
immediate: true
})
timer.start()
await sleep(0)
await sleep(50)
expect(callback).toHaveBeenCalledTimes(1)
})
test('should call callback reset', async () => {
Expand Down Expand Up @@ -286,7 +286,7 @@ describe('Test timer', () => {
includeAsyncTime: true
})
timer.start()
await sleep(0)
await sleep(50)
expect(callback).toHaveBeenCalledTimes(1)
})

Expand All @@ -301,7 +301,7 @@ describe('Test timer', () => {
includeAsyncTime: true
})
timer.start()
await sleep(0)
await sleep(50)
expect(callback).toHaveBeenCalledTimes(0)
})

Expand Down
Loading

0 comments on commit 13819fa

Please sign in to comment.