Skip to content

Commit 8d99bb2

Browse files
committed
Return self in subscribeState:usingBlock of STNetTaskGroup to support invocation chain.
1 parent ba0a1d5 commit 8d99bb2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

STNetTaskQueue/STNetTaskGroup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ typedef void (^STNetTaskGroupSubscriptionBlock)(STNetTaskGroup *group, NSError *
8888
@param state STNetTaskGroupState
8989
@param block STNetTaskGroupSubscriptionBlock
9090
*/
91-
- (void)subscribeState:(STNetTaskGroupState)state usingBlock:(STNetTaskGroupSubscriptionBlock)block;
91+
- (STNetTaskGroup *)subscribeState:(STNetTaskGroupState)state usingBlock:(STNetTaskGroupSubscriptionBlock)block;
9292

9393
/**
9494
Start executing tasks in this group.

STNetTaskQueue/STNetTaskGroup.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ - (void)addTask:(STNetTask *)task
4545
self.tasks = [NSArray arrayWithArray:tasks];
4646
}
4747

48-
- (void)subscribeState:(STNetTaskGroupState)state usingBlock:(STNetTaskGroupSubscriptionBlock)block
48+
- (STNetTaskGroup *)subscribeState:(STNetTaskGroupState)state usingBlock:(STNetTaskGroupSubscriptionBlock)block
4949
{
5050
if (!self.stateToBlock) {
5151
self.stateToBlock = [NSMutableDictionary new];
@@ -56,6 +56,7 @@ - (void)subscribeState:(STNetTaskGroupState)state usingBlock:(STNetTaskGroupSubs
5656
self.stateToBlock[@(state)] = blocks;
5757
}
5858
[blocks addObject:[block copy]];
59+
return self;
5960
}
6061

6162
- (void)notifyState:(STNetTaskGroupState)state withError:(NSError *)error

0 commit comments

Comments
 (0)