Skip to content

ytyubox/Timing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Timing

Rx Debounce & Throttle without Rx

from reactivex.io

from rxjs.dev

Setting up

lazy var debouncer = Debounce<String>(timeInterval: 0.5) {
    self.debounceLabel.text = $0
    self.debounceLabel.sizeToFit()
}

lazy var throttler = Throttle<String>(timeInterval: 1,
                                      isEnable: false) {
    (text) in
    self.throttleLabel.text = text
    self.throttleLabel.sizeToFit()
}

Event feeding

debouncer.receive(sender.text!)

throttler.receive(text)

About

Debounce & Throttle without the Rx

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages