-
Notifications
You must be signed in to change notification settings - Fork 82
/
MTSignal.h
62 lines (39 loc) · 1.59 KB
/
MTSignal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#import <Foundation/Foundation.h>
#import "MTSubscriber.h"
@class MTQueue;
@interface MTSignal : NSObject
{
@public
id<MTDisposable> (^_generator)(MTSubscriber *);
}
- (instancetype)initWithGenerator:(id<MTDisposable> (^)(MTSubscriber *))generator;
- (id<MTDisposable>)startWithNext:(void (^)(id next))next error:(void (^)(id error))error completed:(void (^)())completed;
- (id<MTDisposable>)startWithNext:(void (^)(id next))next;
- (id<MTDisposable>)startWithNext:(void (^)(id next))next completed:(void (^)())completed;
+ (MTSignal *)single:(id)next;
+ (MTSignal *)fail:(id)error;
+ (MTSignal *)never;
+ (MTSignal *)complete;
- (MTSignal *)then:(MTSignal *)signal;
- (MTSignal *)delay:(NSTimeInterval)seconds onQueue:(MTQueue *)queue;
- (MTSignal *)timeout:(NSTimeInterval)seconds onQueue:(MTQueue *)queue orSignal:(MTSignal *)signal;
- (MTSignal *)catch:(MTSignal *(^)(id error))f;
+ (MTSignal *)mergeSignals:(NSArray *)signals;
+ (MTSignal *)combineSignals:(NSArray *)signals;
- (MTSignal *)restart;
- (MTSignal *)take:(NSUInteger)count;
- (MTSignal *)switchToLatest;
- (MTSignal *)map:(id (^)(id))f;
- (MTSignal *)filter:(bool (^)(id))f;
- (MTSignal *)mapToSignal:(MTSignal *(^)(id))f;
- (MTSignal *)onDispose:(void (^)())f;
- (MTSignal *)deliverOn:(MTQueue *)queue;
- (MTSignal *)startOn:(MTQueue *)queue;
- (MTSignal *)takeLast;
- (MTSignal *)reduceLeft:(id)value with:(id (^)(id, id))f;
@end
@interface MTPipe : NSObject
@property (nonatomic, copy, readonly) MTSignal *(^signalProducer)();
@property (nonatomic, copy, readonly) void (^sink)(id);
- (instancetype)initWithReplay:(bool)replay;
@end