SlideShare a Scribd company logo
1 of 25
Reactive Extensions for JavaScript @JimWooley http://www.ThinqLinq.com Consultant
Reactive Framework “Rx is a library for  composingasynchronousand event-based operations using  observable collections.”
Reactive Framework “RxJsis a library for  composingasynchronousand event-based operations using  observable prototypes.”
Observable Collection - Common Uses
Flavors of Rx RxJs
IEnumerator vs. IObserver public interface IEnumerator {    object Current { get; }    bool MoveNext();    void Reset(); } Blocking public interface IObserver<T> {     void OnCompleted();     void OnError(Exception exception);     void OnNext(T value); }
LINQ for Javascript? C# Query Syntax var query = from c in Customers                     where c.City == "Chattanooga“                     select c.Name;  C# Lambda Syntax var query = Customers                     .Where(c => c.City == "Chattanooga")                     .Select(c => c.Name); JavaScript var query = Customers                     .Where(function (c) { return c.City === “Chattanooga” ; })                     .Select(function (c) { return c.Name; });
Using Rx to query in Javascript demo
Rx Observable Pattern         var obs = ...;         // query?         var sub = obs.Subscribe(             onNext : v => DoSomething(v),             onError : e => HandleError(e),             onCompleted : () => HandleDone);         sub.Dispose();
RxJs Observable Pattern         var obs = ...;        // query?        var sub = obs.Subscribe(             function(v) { DoSomething(v); },             function(e) { HandleError(e); },             function() { HandleDone(); });         sub.Dispose();
var geo = Rx.Observable.Create(function (observer) {  var watchId = navigator.geolocation.watchPosition(         function (pos) { observer.OnNext(pos.coords);  },        function (err) { observer.OnError(err);  }    );         return function () {          navigator.geolocation.clearWatch(watchId);     }; }); var d = geo.Subscribe(function(pos)  {  alert(pos);  }); … d.Dispose(); Observable.Create 8675309 8675309
RX.Observable.Prototype Generator Flow Query Select Let Where Take Skip GroupBy Do Catch Finally OnErrorResumeNext Flow Scan DistinctUntilChanged Replay SkipLast TakeLast Subscribe Dematerialize AsObservsable Publish StartsWith Merge MergeObservable Concat Zip CombineLatest Switch SelectMany TakeWhile TakeUntil SkipUntil Prune Time        TimeInterval RemoveInterval RemoveTimestamp BufferWithTime BufferWithCount Throttle Sample Repeat Retry Timeout Delay
Factory Generators Rx.Observable.Range(0,5); Rx.Observable.Return(“This is a single value”); Rx.Observable.FromArray([“a”, “b”, “c”]); Rx.Observable.Timer(1000,2000); Rx.Observable.Create(function(subscriber) { return  function() { unsub() }}); Rx.Observable.FromDOMEvent(Document.GetElementById(“image”), “mousemove”); Rx.Observable.FromJQuery($(“div,, span”), “click”); $(“div, span”).ToObservable(“click”); Rx.Obsevable.XmlHttpRequest(url);
Demo Generating Observables
Combining streams
SelectMany varObservableY = ObservableX.SelectMany(function(x) { SomeGenerator(x); }); Ox fx fx fx Oy Oy Oy Oy
TakeUntil oX oY oX
Observable Events ,[object Object]
Standardize event model
Disposable
Supports DI
Mockable,[object Object]
Asynchronous Service Requests Throttle BingTranslator Translate ObservableX TakeUntil
Asynchronous Services demo
Why RxJs? ,[object Object]

More Related Content

What's hot

Intro to Functional Programming with RxJava
Intro to Functional Programming with RxJavaIntro to Functional Programming with RxJava
Intro to Functional Programming with RxJavaMike Nakhimovich
 
Introduction to RxJava on Android
Introduction to RxJava on AndroidIntroduction to RxJava on Android
Introduction to RxJava on AndroidChris Arriola
 
Streams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to RxStreams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to RxAndrzej Sitek
 
Introduction to Reactive programming
Introduction to Reactive programmingIntroduction to Reactive programming
Introduction to Reactive programmingDwi Randy Herdinanto
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJavaJobaer Chowdhury
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaRick Warren
 
An Introduction to Reactive Cocoa
An Introduction to Reactive CocoaAn Introduction to Reactive Cocoa
An Introduction to Reactive CocoaSmartLogic
 
The Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on AndroidThe Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on AndroidFernando Cejas
 
Journey into Reactive Streams and Akka Streams
Journey into Reactive Streams and Akka StreamsJourney into Reactive Streams and Akka Streams
Journey into Reactive Streams and Akka StreamsKevin Webber
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with RxjavaChristophe Marchal
 
Till Rohrmann – Fault Tolerance and Job Recovery in Apache Flink
Till Rohrmann – Fault Tolerance and Job Recovery in Apache FlinkTill Rohrmann – Fault Tolerance and Job Recovery in Apache Flink
Till Rohrmann – Fault Tolerance and Job Recovery in Apache FlinkFlink Forward
 
Gpars - the coolest bits
Gpars - the coolest bitsGpars - the coolest bits
Gpars - the coolest bitsArtur Gajowy
 
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overviewFlink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overviewFlink Forward
 
Going Reactive with Spring 5
Going Reactive with Spring 5Going Reactive with Spring 5
Going Reactive with Spring 5Drazen Nikolic
 
The Future starts with a Promise
The Future starts with a PromiseThe Future starts with a Promise
The Future starts with a PromiseAlexandru Nedelcu
 
Scala Future & Promises
Scala Future & PromisesScala Future & Promises
Scala Future & PromisesKnoldus Inc.
 

What's hot (20)

Javantura v3 - Going Reactive with RxJava – Hrvoje Crnjak
Javantura v3 - Going Reactive with RxJava – Hrvoje CrnjakJavantura v3 - Going Reactive with RxJava – Hrvoje Crnjak
Javantura v3 - Going Reactive with RxJava – Hrvoje Crnjak
 
Intro to Functional Programming with RxJava
Intro to Functional Programming with RxJavaIntro to Functional Programming with RxJava
Intro to Functional Programming with RxJava
 
Introduction to RxJava on Android
Introduction to RxJava on AndroidIntroduction to RxJava on Android
Introduction to RxJava on Android
 
Streams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to RxStreams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to Rx
 
RxJava@Android
RxJava@AndroidRxJava@Android
RxJava@Android
 
Reactive
ReactiveReactive
Reactive
 
Introduction to Reactive programming
Introduction to Reactive programmingIntroduction to Reactive programming
Introduction to Reactive programming
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJava
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
 
An Introduction to Reactive Cocoa
An Introduction to Reactive CocoaAn Introduction to Reactive Cocoa
An Introduction to Reactive Cocoa
 
The Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on AndroidThe Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on Android
 
Journey into Reactive Streams and Akka Streams
Journey into Reactive Streams and Akka StreamsJourney into Reactive Streams and Akka Streams
Journey into Reactive Streams and Akka Streams
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with Rxjava
 
Till Rohrmann – Fault Tolerance and Job Recovery in Apache Flink
Till Rohrmann – Fault Tolerance and Job Recovery in Apache FlinkTill Rohrmann – Fault Tolerance and Job Recovery in Apache Flink
Till Rohrmann – Fault Tolerance and Job Recovery in Apache Flink
 
Gpars - the coolest bits
Gpars - the coolest bitsGpars - the coolest bits
Gpars - the coolest bits
 
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overviewFlink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
Flink Forward SF 2017: Kenneth Knowles - Back to Sessions overview
 
Spring batch in action
Spring batch in actionSpring batch in action
Spring batch in action
 
Going Reactive with Spring 5
Going Reactive with Spring 5Going Reactive with Spring 5
Going Reactive with Spring 5
 
The Future starts with a Promise
The Future starts with a PromiseThe Future starts with a Promise
The Future starts with a Promise
 
Scala Future & Promises
Scala Future & PromisesScala Future & Promises
Scala Future & Promises
 

Viewers also liked

Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJSstefanmayer13
 
Add Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSAdd Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSRyan Anklam
 
Rethink Async With RXJS
Rethink Async With RXJSRethink Async With RXJS
Rethink Async With RXJSRyan Anklam
 
RxJS Evolved
RxJS EvolvedRxJS Evolved
RxJS Evolvedtrxcllnt
 
RxJS - The Reactive extensions for JavaScript
RxJS - The Reactive extensions for JavaScriptRxJS - The Reactive extensions for JavaScript
RxJS - The Reactive extensions for JavaScriptViliam Elischer
 
ReactiveX-SEA
ReactiveX-SEAReactiveX-SEA
ReactiveX-SEAYang Yang
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web AppsKevin Dantas
 
Programação reativa com RxJS e Angular
Programação reativa com RxJS e AngularProgramação reativa com RxJS e Angular
Programação reativa com RxJS e AngularWendel Nascimento
 
Reactive programming
Reactive programmingReactive programming
Reactive programmingSunscrapers
 
RxJS 5 in Depth
RxJS 5 in DepthRxJS 5 in Depth
RxJS 5 in DepthC4Media
 
Functional Reactive Angular 2
Functional Reactive Angular 2 Functional Reactive Angular 2
Functional Reactive Angular 2 Tomasz Bak
 
Functional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsFunctional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsLeonardo Borges
 
Material Design - do smartphone ao desktop
Material Design - do smartphone ao desktopMaterial Design - do smartphone ao desktop
Material Design - do smartphone ao desktopHillary Sousa
 
WebApps com Web Components
WebApps com Web ComponentsWebApps com Web Components
WebApps com Web ComponentsBeto Muniz
 
Polymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in RealtimePolymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in RealtimeJuarez Filho
 

Viewers also liked (20)

Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJS
 
Add Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSAdd Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJS
 
Rethink Async With RXJS
Rethink Async With RXJSRethink Async With RXJS
Rethink Async With RXJS
 
RxJS Evolved
RxJS EvolvedRxJS Evolved
RxJS Evolved
 
RxJS - The Reactive extensions for JavaScript
RxJS - The Reactive extensions for JavaScriptRxJS - The Reactive extensions for JavaScript
RxJS - The Reactive extensions for JavaScript
 
FRP with Ractive and RxJS
FRP with Ractive and RxJSFRP with Ractive and RxJS
FRP with Ractive and RxJS
 
ReactiveX-SEA
ReactiveX-SEAReactiveX-SEA
ReactiveX-SEA
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
Programação reativa com RxJS e Angular
Programação reativa com RxJS e AngularProgramação reativa com RxJS e Angular
Programação reativa com RxJS e Angular
 
Reactive programming
Reactive programmingReactive programming
Reactive programming
 
RxJS 5 in Depth
RxJS 5 in DepthRxJS 5 in Depth
RxJS 5 in Depth
 
Functional Reactive Angular 2
Functional Reactive Angular 2 Functional Reactive Angular 2
Functional Reactive Angular 2
 
Functional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event SystemsFunctional Reactive Programming / Compositional Event Systems
Functional Reactive Programming / Compositional Event Systems
 
Angular2 + rxjs
Angular2 + rxjsAngular2 + rxjs
Angular2 + rxjs
 
Rxjs ngvikings
Rxjs ngvikingsRxjs ngvikings
Rxjs ngvikings
 
Rxjs ppt
Rxjs pptRxjs ppt
Rxjs ppt
 
Material Design - do smartphone ao desktop
Material Design - do smartphone ao desktopMaterial Design - do smartphone ao desktop
Material Design - do smartphone ao desktop
 
WebApps com Web Components
WebApps com Web ComponentsWebApps com Web Components
WebApps com Web Components
 
Polymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in RealtimePolymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in Realtime
 
Polymer Starter Kit
Polymer Starter KitPolymer Starter Kit
Polymer Starter Kit
 

Similar to Reactive Extensions for JavaScript

Rxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaRxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaKros Huang
 
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJSAbul Hasan
 
Ft10 de smet
Ft10 de smetFt10 de smet
Ft10 de smetnkaluva
 
Reactive Programming with RxJS
Reactive Programming with RxJSReactive Programming with RxJS
Reactive Programming with RxJSDanca Prima
 
Reactive java programming for the impatient
Reactive java programming for the impatientReactive java programming for the impatient
Reactive java programming for the impatientGrant Steinfeld
 
Reactive Extensions (Rx)
Reactive Extensions (Rx)Reactive Extensions (Rx)
Reactive Extensions (Rx)Mark Allan
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...PROIDEA
 
ReactiveX
ReactiveXReactiveX
ReactiveXBADR
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationAndrew Rota
 
Reactive in Android and Beyond Rx
Reactive in Android and Beyond RxReactive in Android and Beyond Rx
Reactive in Android and Beyond RxFabio Tiriticco
 
How to unit test your React/Redux app
How to unit test your React/Redux appHow to unit test your React/Redux app
How to unit test your React/Redux appAlin Pandichi
 
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorReactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorVMware Tanzu
 
Javascript under the hood
Javascript under the hoodJavascript under the hood
Javascript under the hoodRidhwana Khan
 
Ajax Under The Hood
Ajax Under The HoodAjax Under The Hood
Ajax Under The HoodWO Community
 
Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018Trayan Iliev
 
Scala.js for large and complex frontend apps
Scala.js for large and complex frontend appsScala.js for large and complex frontend apps
Scala.js for large and complex frontend appsOtto Chrons
 
Reactive extensions itjam
Reactive extensions itjamReactive extensions itjam
Reactive extensions itjamCiklum Ukraine
 

Similar to Reactive Extensions for JavaScript (20)

Rxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaRxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJava
 
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJS
 
Ft10 de smet
Ft10 de smetFt10 de smet
Ft10 de smet
 
Reactive Programming with RxJS
Reactive Programming with RxJSReactive Programming with RxJS
Reactive Programming with RxJS
 
Reactive java programming for the impatient
Reactive java programming for the impatientReactive java programming for the impatient
Reactive java programming for the impatient
 
Reactive Extensions (Rx)
Reactive Extensions (Rx)Reactive Extensions (Rx)
Reactive Extensions (Rx)
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
 
ReactiveX
ReactiveXReactiveX
ReactiveX
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
 
Open sourcing the store
Open sourcing the storeOpen sourcing the store
Open sourcing the store
 
Reactive in Android and Beyond Rx
Reactive in Android and Beyond RxReactive in Android and Beyond Rx
Reactive in Android and Beyond Rx
 
How to unit test your React/Redux app
How to unit test your React/Redux appHow to unit test your React/Redux app
How to unit test your React/Redux app
 
Ajax
AjaxAjax
Ajax
 
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorReactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
 
Javascript under the hood
Javascript under the hoodJavascript under the hood
Javascript under the hood
 
Rx java in action
Rx java in actionRx java in action
Rx java in action
 
Ajax Under The Hood
Ajax Under The HoodAjax Under The Hood
Ajax Under The Hood
 
Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018
 
Scala.js for large and complex frontend apps
Scala.js for large and complex frontend appsScala.js for large and complex frontend apps
Scala.js for large and complex frontend apps
 
Reactive extensions itjam
Reactive extensions itjamReactive extensions itjam
Reactive extensions itjam
 

More from Jim Wooley

Improving code quality with Roslyn analyzers
Improving code quality with Roslyn analyzersImproving code quality with Roslyn analyzers
Improving code quality with Roslyn analyzersJim Wooley
 
Tearing down the //build/ 2016 conference
Tearing down the //build/ 2016 conferenceTearing down the //build/ 2016 conference
Tearing down the //build/ 2016 conferenceJim Wooley
 
Windows 8 as an Application Integration Hub
Windows 8 as an Application Integration HubWindows 8 as an Application Integration Hub
Windows 8 as an Application Integration HubJim Wooley
 
Entity Framework Migration
Entity Framework MigrationEntity Framework Migration
Entity Framework MigrationJim Wooley
 
Dynamic programming in a statically typed world
Dynamic programming in a statically typed worldDynamic programming in a statically typed world
Dynamic programming in a statically typed worldJim Wooley
 

More from Jim Wooley (8)

Improving code quality with Roslyn analyzers
Improving code quality with Roslyn analyzersImproving code quality with Roslyn analyzers
Improving code quality with Roslyn analyzers
 
Tearing down the //build/ 2016 conference
Tearing down the //build/ 2016 conferenceTearing down the //build/ 2016 conference
Tearing down the //build/ 2016 conference
 
Ssdt wooley
Ssdt wooleySsdt wooley
Ssdt wooley
 
Windows 8 as an Application Integration Hub
Windows 8 as an Application Integration HubWindows 8 as an Application Integration Hub
Windows 8 as an Application Integration Hub
 
Linq tools
Linq toolsLinq tools
Linq tools
 
Entity Framework Migration
Entity Framework MigrationEntity Framework Migration
Entity Framework Migration
 
Dynamic programming in a statically typed world
Dynamic programming in a statically typed worldDynamic programming in a statically typed world
Dynamic programming in a statically typed world
 
Rx forwp7
Rx forwp7Rx forwp7
Rx forwp7
 

Recently uploaded

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Recently uploaded (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Reactive Extensions for JavaScript

  • 1. Reactive Extensions for JavaScript @JimWooley http://www.ThinqLinq.com Consultant
  • 2. Reactive Framework “Rx is a library for composingasynchronousand event-based operations using observable collections.”
  • 3. Reactive Framework “RxJsis a library for composingasynchronousand event-based operations using observable prototypes.”
  • 6. IEnumerator vs. IObserver public interface IEnumerator {    object Current { get; }    bool MoveNext();    void Reset(); } Blocking public interface IObserver<T> {     void OnCompleted();     void OnError(Exception exception);     void OnNext(T value); }
  • 7. LINQ for Javascript? C# Query Syntax var query = from c in Customers                     where c.City == "Chattanooga“                     select c.Name; C# Lambda Syntax var query = Customers                     .Where(c => c.City == "Chattanooga")                     .Select(c => c.Name); JavaScript var query = Customers                     .Where(function (c) { return c.City === “Chattanooga” ; })                     .Select(function (c) { return c.Name; });
  • 8. Using Rx to query in Javascript demo
  • 9. Rx Observable Pattern         var obs = ...; // query?         var sub = obs.Subscribe(             onNext : v => DoSomething(v),             onError : e => HandleError(e),             onCompleted : () => HandleDone);         sub.Dispose();
  • 10. RxJs Observable Pattern         var obs = ...; // query?        var sub = obs.Subscribe(             function(v) { DoSomething(v); },             function(e) { HandleError(e); },             function() { HandleDone(); });         sub.Dispose();
  • 11. var geo = Rx.Observable.Create(function (observer) { var watchId = navigator.geolocation.watchPosition( function (pos) { observer.OnNext(pos.coords);  },        function (err) { observer.OnError(err);  } );         return function () {          navigator.geolocation.clearWatch(watchId);     }; }); var d = geo.Subscribe(function(pos) { alert(pos); }); … d.Dispose(); Observable.Create 8675309 8675309
  • 12. RX.Observable.Prototype Generator Flow Query Select Let Where Take Skip GroupBy Do Catch Finally OnErrorResumeNext Flow Scan DistinctUntilChanged Replay SkipLast TakeLast Subscribe Dematerialize AsObservsable Publish StartsWith Merge MergeObservable Concat Zip CombineLatest Switch SelectMany TakeWhile TakeUntil SkipUntil Prune Time TimeInterval RemoveInterval RemoveTimestamp BufferWithTime BufferWithCount Throttle Sample Repeat Retry Timeout Delay
  • 13. Factory Generators Rx.Observable.Range(0,5); Rx.Observable.Return(“This is a single value”); Rx.Observable.FromArray([“a”, “b”, “c”]); Rx.Observable.Timer(1000,2000); Rx.Observable.Create(function(subscriber) { return function() { unsub() }}); Rx.Observable.FromDOMEvent(Document.GetElementById(“image”), “mousemove”); Rx.Observable.FromJQuery($(“div,, span”), “click”); $(“div, span”).ToObservable(“click”); Rx.Obsevable.XmlHttpRequest(url);
  • 16. SelectMany varObservableY = ObservableX.SelectMany(function(x) { SomeGenerator(x); }); Ox fx fx fx Oy Oy Oy Oy
  • 18.
  • 22.
  • 23. Asynchronous Service Requests Throttle BingTranslator Translate ObservableX TakeUntil
  • 25.
  • 29. Async time related operations
  • 32.
  • 33.
  • 35. Download at MSDN Data Developer CenterJoin the Community (MSDN forums) http://social.msdn.microsoft.com/Forums/en-US/rx
  • 37. Fill out your Surveys reminder