Files
youle_app_ios/Pods/Qiniu/QiniuSDK/Utils/QNSingleFlight.h

31 lines
887 B
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// QNSingleFlight.h
// QiniuSDK
//
// Created by yangsen on 2021/1/4.
// Copyright © 2021 Qiniu. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef void(^QNSingleFlightComplete)(id _Nullable value, NSError * _Nullable error);
typedef void(^QNSingleFlightAction)(QNSingleFlightComplete _Nonnull complete);
@interface QNSingleFlight : NSObject
/**
* 异步 SingleFlight 执行函数
* @param key actionHandler 对应的 key同一时刻同一个 key 最多只有一个对应的 actionHandler 在执行
* @param action 执行函数注意action 有且只能回调一次
* @param complete single flight 执行 complete 后的完成回调
*/
- (void)perform:(NSString * _Nullable)key
action:(QNSingleFlightAction _Nonnull)action
complete:(QNSingleFlightComplete _Nullable)complete;
@end
NS_ASSUME_NONNULL_END