File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Tool/Sources/DebounceFunction Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ public actor ThrottleFunction<T> {
88 var lastFinishTime : Date = . init( timeIntervalSince1970: 0 )
99 var now : ( ) -> Date = { Date ( ) }
1010
11- public init ( duration: TimeInterval , block: @escaping ( T ) async -> Void ) {
11+ public init ( duration: TimeInterval , block: @escaping @ Sendable ( T) async -> Void ) {
1212 self . duration = duration
1313 self . block = block
1414 }
@@ -50,13 +50,13 @@ public actor ThrottleRunner {
5050 self . duration = duration
5151 }
5252
53- public func throttle( block: @escaping ( ) async -> Void ) {
53+ public func throttle( block: @escaping @ Sendable ( ) async -> Void ) {
5454 if task == nil {
5555 scheduleTask ( wait: now ( ) . timeIntervalSince ( lastFinishTime) < duration, block: block)
5656 }
5757 }
5858
59- func scheduleTask( wait: Bool , block: @escaping ( ) async -> Void ) {
59+ func scheduleTask( wait: Bool , block: @escaping @ Sendable ( ) async -> Void ) {
6060 task = Task . detached { [ weak self] in
6161 guard let self else { return }
6262 do {
You can’t perform that action at this time.
0 commit comments