mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-07 08:01:10 +00:00
46 lines
1.2 KiB
Objective-C
46 lines
1.2 KiB
Objective-C
#import "SSignal.h"
|
|
|
|
@interface SSignal ()
|
|
{
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation SSignal
|
|
|
|
- (instancetype)initWithGenerator:(id<SDisposable> (^)(SSubscriber *))generator
|
|
{
|
|
self = [super init];
|
|
if (self != nil)
|
|
{
|
|
_generator = [generator copy];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (id<SDisposable>)startWithNext:(void (^)(id next))next error:(void (^)(id error))error completed:(void (^)())completed
|
|
{
|
|
SSubscriber *subscriber = [[SSubscriber alloc] initWithNext:next error:error completed:completed];
|
|
id<SDisposable> disposable = _generator(subscriber);
|
|
[subscriber _assignDisposable:disposable];
|
|
return disposable;
|
|
}
|
|
|
|
- (id<SDisposable>)startWithNext:(void (^)(id next))next
|
|
{
|
|
SSubscriber *subscriber = [[SSubscriber alloc] initWithNext:next error:nil completed:nil];
|
|
id<SDisposable> disposable = _generator(subscriber);
|
|
[subscriber _assignDisposable:disposable];
|
|
return disposable;
|
|
}
|
|
|
|
- (id<SDisposable>)startWithNext:(void (^)(id next))next completed:(void (^)())completed
|
|
{
|
|
SSubscriber *subscriber = [[SSubscriber alloc] initWithNext:next error:nil completed:completed];
|
|
id<SDisposable> disposable = _generator(subscriber);
|
|
[subscriber _assignDisposable:disposable];
|
|
return disposable;
|
|
}
|
|
|
|
@end
|