项目作者: ytyubox

项目描述 :
Debounce & Throttle without the Rx
高级语言: Swift
项目地址: git://github.com/ytyubox/Timing.git
创建时间: 2020-07-17T10:19:14Z
项目社区:https://github.com/ytyubox/Timing

开源协议:

下载


Timing

Rx Debounce & Throttle without Rx

from reactivex.io

from rxjs.dev

Setting up

  1. lazy var debouncer = Debounce<String>(timeInterval: 0.5) {
  2. self.debounceLabel.text = $0
  3. self.debounceLabel.sizeToFit()
  4. }
  5. lazy var throttler = Throttle<String>(timeInterval: 1,
  6. isEnable: false) {
  7. (text) in
  8. self.throttleLabel.text = text
  9. self.throttleLabel.sizeToFit()
  10. }

Event feeding

  1. debouncer.receive(sender.text!)
  2. throttler.receive(text)