Tyrannosaurus Rx Reactive Extensions

Tyrannosaurus Rx Reactive Extensions

TYRANNOSAURUS RX REACTIVE EXTENSIONS C# JS Java Python Clojure Ruby Groovy C++ Scala Haskell Kotlin var list = [1,2,3,4,5,6,7]; ! for(var i = 0; i < list.length; i++) { console.log(list[i]) } var list = [1,2,3,4,5,6,7]; ! list.forEach(function(item) { console.log(item) }) var list = [Promise(), Promise()…]; ! list.forEach(function(item) { console.log(item.get()) }) TIME RUINS EVERYTHING OBSERVABLES LISTS WITH TIME REIFIED EVENT STREAM PUSH BASED CREATING OBSERVABLES ITERABLE FUTURE/PROMISE OBSERVABLE EVENTS RULES CREATING OBSERVABLES Observable.from(new String[] { "The Joker", "The Riddler", "Penguin", "Catwoman"}) CREATING OBSERVABLES baddies.subscribe((baddie) -> { out.println(baddie + “ is bad.”) }) CREATING OBSERVABLES The Joker is bad. The Riddler is bad. Penguin is bad. Catwoman is bad. CREATING OBSERVABLES class _ extends Subscriber<String> { void onCompleted() {} void onError(Throwable t) {} void onNext(String s){} } CREATING OBSERVABLES onNext("The Joker”) CREATING OBSERVABLESonNext("The Riddler”) onNext("The Joker”) onNext(“Penguin") CREATING OBSERVABLESonNext("The Riddler”) onNext("The Joker”) onNext(“Catwoman") onNext(“Penguin") CREATING OBSERVABLESonNext("The Riddler”) onNext("The Joker”) onCompleted() onNext(“Catwoman") onNext(“Penguin") CREATING OBSERVABLESonNext("The Riddler”) onNext("The Joker”) ERROR HANDLING onNext("The Joker”) ERROR HANDLINGonNext("The Riddler”) onNext("The Joker”) X ERROR HANDLINGonNext("The Riddler”) onNext("The Joker”) onError(ex) X ERROR HANDLINGonNext("The Riddler”) onNext("The Joker”) TRANSFORMING OBSERVABLES TURN AN OBSERVABLE OF ONE TYPE INTO ANOTHER TRANSFORMING OBSERVABLES Observable ints = Observable .interval(1, SECONDS); ! ints.map((i) -> i + 1) .map((i) -> i + “ seconds”) .subscribe(out::println) TRANSFORMING OBSERVABLES map map TRANSFORMING OBSERVABLES 1 seconds 2 seconds 3 seconds 4 seconds ... TRANSFORMING OBSERVABLES flatMap(), groupBy(), buffer(), window() FILTERING OBSERVABLES SELECT AND REJECT ITEMS EMITTED BY AN OBSERVABLE FILTERING OBSERVABLES var keys = Rx.DOM.keypress(el) var ints = keys.filter(isNumeric) ! ints.subscribe(console.log) FILTERING OBSERVABLES filter X X FILTERING OBSERVABLES distinct(), timeout(), ignoreElements(), throttleFirst(), debounce(), sample(), first(), last(), take(), skip() COMBINING OBSERVABLES COMPOSING MULTIPLE OBSERVABLES INTO A SINGLE OBSERVABLE COMBINING OBSERVABLES Observable goodies = Observable.from( new String[]{ "Batman", "Robin", "Alfred", “Batgirl"}); ! goodies.zipWith(baddies, (g,b) -> g + " punches " + b) COMBINING OBSERVABLES zipWith COMBINING OBSERVABLES Batman punches The Joker Robin punches The Riddler Alfred punches Penguin Batgirl punches Catwoman STUFF AND OTHER THINGS retry(), delay(), timestamp(), amb(), defaultIfEmpty(), reduce(), count() TYRANNOSAURUS RX .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    42 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us