Skip to content

Instantly share code, notes, and snippets.

@SunXiaoShan
Created July 17, 2017 06:41
Show Gist options
  • Save SunXiaoShan/3508c13516c7f3290cd9f2334b64fe77 to your computer and use it in GitHub Desktop.
Save SunXiaoShan/3508c13516c7f3290cd9f2334b64fe77 to your computer and use it in GitHub Desktop.
ThrottleDemo
const NSTimeInterval INTERVAL_TIME = 0.5; // 0.5 sec
RACSubject *subject = [RACSubject subject];
[[subject throttle:INTERVAL_TIME] subscribeNext:^(id _Nullable x) {
NSLog(@"%@",x);
}];
[subject sendNext:@1];
[subject sendNext:@2];
[subject sendNext:@3];
[subject sendNext:@4];
// output : 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment