Skip to content

Commit 369e189

Browse files
committed
update solve problem to Timeout cancellation
1 parent e33266c commit 369e189

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Diff for: 2715. timeout-cancellation/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const cancellable = (fn, args, t) => {
2+
var timer = setTimeout(() => {
3+
fn.apply(this, args)
4+
}, t)
5+
return () => {
6+
clearTimeout(timer)
7+
}
8+
}

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
| Memoize | |
1818
| Add Two Promises ||
1919
| Sleep ||
20-
| Timeout Cancellation | |
20+
| Timeout Cancellation | |
2121
| Interval Cancellation | |
2222
| Promise Time Limit | |
2323
| Cache With Time Limit | |

0 commit comments

Comments
 (0)