We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testcase: func testDebounce() { let exp = self.expectation(description: "Task") Task { var runCount = 0 for i in 0..<10 { debounce(option: .runFirst) { print(Date().printFormat(), "debounce test: (i)") runCount += 1 } try? await Task.sleep(for: .milliseconds(600)) } // exp.fulfill() } self.wait(for: [exp], timeout: 10) } result: 2024-04-28 09:49:41.257 debounce test: 0 2024-04-28 09:49:41.879 debounce test: 1 2024-04-28 09:49:42.289 debounce test: 0 2024-04-28 01:49:42 +0000 task is cancelled 2024-04-28 01:49:43 +0000 task is cancelled 2024-04-28 01:49:43 +0000 task is cancelled 2024-04-28 01:49:44 +0000 task is cancelled 2024-04-28 01:49:44 +0000 task is cancelled 2024-04-28 01:49:45 +0000 task is cancelled 2024-04-28 01:49:46 +0000 task is cancelled 2024-04-28 01:49:46 +0000 task is cancelled 2024-04-28 09:49:47.855 debounce test: 9
two problem:
duration
the debounce expect in duration only trigger only once, but now, it delay much more time than duration
The text was updated successfully, but these errors were encountered:
No branches or pull requests
testcase:
func testDebounce() {
let exp = self.expectation(description: "Task")
Task {
var runCount = 0
for i in 0..<10 {
debounce(option: .runFirst) {
print(Date().printFormat(), "debounce test: (i)")
runCount += 1
}
try? await Task.sleep(for: .milliseconds(600))
}
// exp.fulfill()
}
self.wait(for: [exp], timeout: 10)
}
result:
2024-04-28 09:49:41.257 debounce test: 0
2024-04-28 09:49:41.879 debounce test: 1
2024-04-28 09:49:42.289 debounce test: 0
2024-04-28 01:49:42 +0000 task is cancelled
2024-04-28 01:49:43 +0000 task is cancelled
2024-04-28 01:49:43 +0000 task is cancelled
2024-04-28 01:49:44 +0000 task is cancelled
2024-04-28 01:49:44 +0000 task is cancelled
2024-04-28 01:49:45 +0000 task is cancelled
2024-04-28 01:49:46 +0000 task is cancelled
2024-04-28 01:49:46 +0000 task is cancelled
2024-04-28 09:49:47.855 debounce test: 9
two problem:
duration
)the debounce expect in
duration
only trigger only once, but now, it delay much more time thanduration
The text was updated successfully, but these errors were encountered: