//
// RACSignal+Operations.h
// ReactiveCocoa
//
// Created by Justin Spahr-Summers on 2012-09-06.
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "RACSignal.h"
/// The domain for errors originating in RACSignal operations.
extern NSString * const RACSignalErrorDomain;
/// The error code used with -timeout:.
extern const NSInteger RACSignalErrorTimedOut;
/// The error code used when a value passed into +switch:cases:default: does not
/// match any of the cases, and no default was given.
extern const NSInteger RACSignalErrorNoMatchingCase;
@class RACCommand;
@class RACDisposable;
@class RACMulticastConnection;
@class RACScheduler;
@class RACSequence;
@class RACSubject;
@class RACTuple;
@protocol RACSubscriber;
@interface RACSignal (Operations)
/// Do the given block on `next`. This should be used to inject side effects into
/// the signal.
- (RACSignal *)doNext:(void (^)(id x))block;
/// Do the given block on `error`. This should be used to inject side effects
/// into the signal.
- (RACSignal *)doError:(void (^)(NSError *error))block;
/// Do the given block on `completed`. This should be used to inject side effects
/// into the signal.
- (RACSignal *)doCompleted:(void (^)(void))block;
/// Sends `next`s only if we don't receive another `next` in `interval` seconds.
///
/// If a `next` is received, and then another `next` is received before
/// `interval` seconds have passed, the first value is discarded.
///
/// After `interval` seconds have passed since the most recent `next` was sent,
/// the most recent `next` is forwarded on the scheduler that the value was
/// originally received on. If +[RACScheduler currentScheduler] was nil at the
/// time, a private background scheduler is used.
///
/// Returns a signal which sends throttled and delayed `next` events. Completion
/// and errors are always forwarded immediately.
- (RACSignal *)throttle:(NSTimeInterval)interval;
/// Throttles `next`s for which `predicate` returns YES.
///
/// When `predicate` returns YES for a `next`:
///
/// 1. If another `next` is received before `interval` seconds have passed, the
/// prior value is discarded. This happens regardless of whether the new
/// value will be throttled.
/// 2. After `interval` seconds have passed since the value was originally
/// received, it will be forwarded on the scheduler that it was received
/// upon. If +[RACScheduler currentScheduler] was nil at the time, a private
/// background scheduler is used.
///
/// When `predicate` returns NO for a `next`, it is forwarded immediately,
/// without any throttling.
///
/// interval - The number of seconds for which to buffer the latest value that
/// passes `predicate`.
/// predicate - Passed each `next` from the receiver, this block returns
/// whether the given value should be throttled. This argument must
/// not be nil.
///
/// Returns a signal which sends `next` events, throttled when `predicate`
/// returns YES. Completion and errors are always forwarded immediately.
- (RACSignal *)throttle:(NSTimeInterval)interval valuesPassingTest:(BOOL (^)(id next))predicate;
/// Forwards `next` and `completed` events after delaying for `interval` seconds
/// on the current scheduler (on which the events were delivered).
///
/// If +[RACScheduler currentScheduler] is nil when `next` or `completed` is
/// received, a private background scheduler is used.
///
/// Returns a signal which sends delayed `next` and `completed` events. Errors
/// are always forwarded immediately.
- (RACSignal *)delay:(NSTimeInterval)interval;
/// Resubscribes when the signal completes.
- (RACSignal *)repeat;
/// Executes the given block each time a subscription is created.
///
/// block - A block which defines the subscription side effects. Cannot be `nil`.
///
/// Example:
///
/// // Write new file, with backup.
/// [[[[fileManager
/// rac_createFileAtPath:path contents:data]
/// initially:^{
/// // 2. Second, backup current file
/// [fileManager moveItemAtPath:path toPath:backupPath error:nil];
/// }]
/// initially:^{
/// // 1. First, acquire write lock.
/// [writeLock lock];
/// }]
/// finally:^{
/// [writeLock unlock];
/// }];
///
/// Returns a signal that passes through all events of the receiver, plus
/// introduces side effects which occur prior to any subscription side effects
/// of the receiver.
- (RACSignal *)initially:(void (^)(void))block;
/// Executes the given block when the signal completes or errors.
- (RACSignal *)finally:(void (^)(void))block;
/// Divides the receiver's `next`s into buffers which deliver every `interval`
/// seconds.
///
/// interval - The interval in which values are grouped into one buffer.
/// scheduler - The scheduler upon which the returned signal will deliver its
/// values. This must not be nil or +[RACScheduler
/// immediateScheduler].
///
/// Returns a signal which sends RACTuples of the buffered values at each
/// interval on `scheduler`. When the receiver completes, any currently-buffered
/// values will be sent immediately.
- (RACSignal *)bufferWithTime:(NSTimeInterval)interval onScheduler:(RACScheduler *)scheduler;
/// Collects all receiver's `next`s into a NSArray. Nil values will be converted
/// to NSNull.
///
/// This corresponds to the `ToArray` method in Rx.
///
/// Returns a signal which sends a single NSArray when the receiver completes
/// successfully.
- (RACSignal *)collect;
/// Takes the last `count` `next`s after the receiving signal completes.
- (RACSignal *)takeLast:(NSUInteger)count;
/// Combines the latest values from the receiver and the given signal into
/// RACTuples, once both have sent at least one `next`.
///
/// Any additional `next`s will result in a new RACTuple with the latest values
/// from both signals.
///
/// signal - The signal to combine with. This argument must not be nil.
///
/// Returns a signal which sends RACTuples of the combined values, forwards any
/// `error` events, and completes when both input signals complete.
- (RACSignal *)combineLatestWith:(RACSignal *)signal;
/// Combines the latest values from the given signals into RACTuples, once all
/// the signals have sent at least one `next`.
///
/// Any additional `next`s will result in a new RACTuple with the latest values
/// from all signals.
///
/// signals - The signals to combine. If this collection is empty, the returned
/// signal will immediately complete upon subscription.
///
/// Returns a signal which sends RACTuples of the combined values, forwards any
/// `error` events, and completes when all input signals complete.
+ (RACSignal *)combineLatest:(id<NSFastEnumeration>)signals;
/// Combines signals using +combineLatest:, then reduces the resulting tuples
/// into a single value using -reduceEach:.
///
/// signals - The signals to combine. If this collection is empty, the
/// returned signal will immediately complete upon subscription.
/// reduceBlock - The block which reduces the latest values from all the
/// signals into one value. It must take as many arguments as the
/// number of signals given. Each argument will be an object
/// argument. The return value must be an object. This argument
/// must not be nil.
///
/// Example:
///
/// [RACSignal combineLatest:@[ stringSignal, intSignal ] reduce:^(NSString *string, NSNumber *number) {
/// return [NSString stringWithFormat:@"%@: %@", string, number];
/// }];
///
/// Returns a signal which sends the results from each invocation of
/// `reduceBlock`.
+ (RACSignal *)combineLatest:(id<NSFastEnumeration>)signals reduce:(id (^)())reduceBlock;
/// Merges the receiver and the given signal with `+merge:` and returns the
/// resulting signal.
- (RACSignal *)merge:(RACSignal *)signal;
/// Sen
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
draw.io mac版 非常好用的画图软件 (187个子文件)
app.asar 49.27MB
electron.asar 230KB
snapshot_blob.bin 1.38MB
natives_blob.bin 257KB
CodeResources 27KB
CodeResources 14KB
CodeResources 6KB
CodeResources 5KB
CodeResources 4KB
CodeResources 2KB
CodeResources 2KB
CodeResources 2KB
crashpad_handler 548KB
Current 1B
Current 1B
Current 1B
Current 1B
icudtl.dat 9.66MB
libnode.dylib 17.8MB
libffmpeg.dylib 2.7MB
Electron Framework 69.38MB
Electron Framework 35B
RACSignal+Operations.h 32KB
metamacros.h 30KB
RACStream.h 13KB
RACSignal.h 9KB
MTLManagedObjectAdapter.h 9KB
MTLJSONAdapter.h 7KB
RACScheduler.h 7KB
SQRLUpdater.h 6KB
RACSequence.h 6KB
RACTuple.h 5KB
MTLModel.h 5KB
MTLModel+NSCoding.h 5KB
RACCommand.h 5KB
NSObject+RACPropertySubscribing.h 5KB
RACKVOChannel.h 4KB
EXTScope.h 4KB
NSValueTransformer+MTLPredefinedTransformerAdditions.h 4KB
ReactiveCocoa.h 4KB
NSObject+RACSelectorSignal.h 4KB
RACBacktrace.h 3KB
RACChannel.h 3KB
NSObject+RACLifting.h 3KB
EXTKeyPathCoding.h 2KB
RACSubscriptingAssignmentTrampoline.h 2KB
RACMulticastConnection.h 2KB
NSObject+RACAppKitBindings.h 2KB
RACCompoundDisposable.h 2KB
RACSubscriber.h 2KB
RACSerialDisposable.h 2KB
RACEvent.h 2KB
RACTestScheduler.h 1KB
RACQueueScheduler+Subclass.h 1KB
NSDictionary+RACSequenceAdditions.h 1KB
NSObject+RACDeallocating.h 1022B
MTLValueTransformer.h 991B
SQRLUpdate.h 972B
SQRLDownloadedUpdate.h 963B
RACDisposable.h 941B
RACScheduler+Subclass.h 939B
NSArray+MTLManipulationAdditions.h 873B
Mantle.h 832B
NSUserDefaults+RACSupport.h 817B
NSDictionary+MTLManipulationAdditions.h 807B
NSURLConnection+RACSupport.h 730B
RACTargetQueueScheduler.h 706B
RACReplaySubject.h 656B
NSString+RACSupport.h 608B
Squirrel.h 587B
NSControl+RACTextSignalSupport.h 568B
NSControl+RACCommandSupport.h 560B
NSBundle+SQRLVersionExtensions.h 560B
NSValueTransformer+MTLInversionAdditions.h 553B
RACSubject.h 548B
NSString+RACSequenceAdditions.h 547B
NSData+RACSupport.h 536B
NSIndexSet+RACSequenceAdditions.h 523B
RACQueueScheduler.h 521B
RACBehaviorSubject.h 517B
NSOrderedSet+RACSequenceAdditions.h 496B
RACScopedDisposable.h 486B
NSArray+RACSequenceAdditions.h 486B
NSSet+RACSequenceAdditions.h 482B
NSEnumerator+RACSequenceAdditions.h 479B
RACGroupedSignal.h 427B
NSProcessInfo+SQRLVersionExtensions.h 424B
NSNotificationCenter+RACSupport.h 419B
NSObject+MTLComparisonAdditions.h 406B
NSText+RACSignalSupport.h 400B
RACUnit.h 390B
NSFileHandle+RACSupport.h 384B
Headers 24B
Headers 24B
Headers 24B
draw.io.icns 88KB
draw.io 18KB
draw.io Helper 18KB
draw.io Helper EH 18KB
draw.io Helper NP 18KB
共 187 条
- 1
- 2
rolin-刘瑞
- 粉丝: 472
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论2