SlideShare a Scribd company logo
You Will Learn RxJS In 2017
Jerry Hong
RxJS
...
• RxJS ? Lodash ?
• RxJS ?
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
...
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
Callback
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
Promise
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
Complex State
Functional Programming
[1, 2, 3].forEach(x => console.log(x));
1
2
3
ForEach
[1, 2, 3].map(x => x + 1);
[2, 3, 4]
Map
[1, 2, 3].filter(x => x % 2 === 1);
[1, 3]
Filter
[[1, 2], [2, 3], [5, 6]].concatAll();
[1, 2, 2, 3, 5, 6]
concatAll
var user = {
id: 888,
name: 'JerryHong',
courseLists: [{
name: 'My Courses',
courses: [
{ title: 'React ', rating: 5 },
{ title: ' ', rating: 4 }
]
}, {
name: 'New Release',
courses: [
{ title: 'Vue 2 ', rating: 5 },
{ title: 'RxJS ', rating: 5 }
]
}]
};
var user = {
id: 888,
name: 'JerryHong',
courseLists: [{
name: 'My Courses',
courses: [
{ title: 'React ', rating: 5 },
{ title: ' ', rating: 4 }
]
}, {
name: 'New Release',
courses: [
{ title: 'Vue 2 ', rating: 5 },
{ title: 'RxJS ', rating: 5 }
]
}]
};
var user = {
id: 888,
name: 'JerryHong',
courseLists: [{
name: 'My Courses',
courses: [
{ title: 'React ', rating: 5 },
{ title: ' ', rating: 4 }
]
}, {
name: 'New Release',
courses: [
{ title: 'Vue 2 ', rating: 5 },
{ title: 'RxJS ', rating: 5 }
]
}]
};
var user = {
id: 888,
name: 'JerryHong',
courseLists: [{
name: 'My Courses',
courses: [
{ title: 'React ', rating: 5 },
{ title: ' ', rating: 4 }
]
}, {
name: 'New Release',
courses: [
{ title: 'Vue 2 ', rating: 5 },
{ title: 'RxJS ', rating: 5 }
]
}]
};
user.courseLists
.map(courseList =>
courseList.courses
.filter(course => course.rating === 5))
.concatAll()
.forEach(course => console.log(course))
rating 5
elmt.mouseDowns
.map(mouseEvent =>
document.mouseMoves
.filter takeUntil(document.mouseUps))
.concatAll()
.forEach(pos => image.position = pos);
...
[{x: 31, y: 23}, {x: 41, y: 23}, {x: 12, y: 45}]
{x: 31, y: 23}...{x: 41, y: 23}...{x: 12, y: 45}
(Collection)


Iterator
Observer
var iterator = [1, 2, 3][Symbol.iterator]();
iterator.next();
{ value: 1, done: false }
iterator.next();
{ value: 2, done: false }
iterator.next();
{ value: 3, done: false }
iterator.next();
{ value: undefined, done: true }
Iterator
iterator 

Map, Filter, ConcatAll
document.addEventListener(

'mousemove', 

function next(event){

console.log(event)

})
{ clientX: 55, clientY: 121 }
{ clientX: 12, clientY: 124 }
{ clientX: 23, clientY: 234 }
{ clientX: 234, clientY: 12 }
{ clientX: 123, clientY: 45 }
{ clientX: 56, clientY: 133 }
Observer
Iterator Observer
document.addEventListener('click', (event) => { ... })
Push
var x = iterator.next()
Pull
Push API
• DOM Events
• Web sockets
• Node Streams
• XMLHttpRequest
• setInterval
• Service Workers
Observable
Observable 

var mouseMove = Observable
.fromEvent(elem, 'mousemove')
Observable for Event
API
• DOM Events
• Web sockets
• Node Streams
• XMLHttpRequest
• setInterval
• Service Workers
=> Observable
var handler = (event) => console.log(event)
// subscribe
document.addEventListener('mousemove', handler)
// unsubscribe
document.removeEventListener('mousemove', handler)
// subscribe
var subscription = mouseMove.subscribe(console.log)
// unsubscribe
subscription.unsubscribe()
Observable
// subscribe
mouseMove.subscribe(
event => console.log(event),
err => console.log('Error: ' + err),
() => console.log('complete')
)
// unsubscribe
mouseMove.unsubscribe()
Observable
-------1---2----3----|
Marble Diagram
time
-------1---2----3----
'--1----2---3'.forEach(x => console.log(x));
1
2
3
ForEach
'--1----2---3'.map(x => x + 1);
2
3
4
Map
'--1----2---3'.filter(x => x % 2 === 1);
1
3
Filter
[[1, 2], [2, 3], [5, 6]].concatAll();
[1, 2, 2, 3, 5, 6]
concatAll
'--o-------o'.concatAll();

  

-1--2| -1-2-3|
1
2
1
2
3
concatAll
'---1--2---1-2-3'
'--1---2----3'.takeUntil(

'--------e');
1
2
'complete'
takeUntil
'--1---2-|'
const dragDOM = document.getElementById('drag');
const mouseDown = Observable
.fromEvent(dragDOM, 'mousedown');
const mouseUp = Observable
.fromEvent(document, 'mouseup');
const mouseMove = Observable
.fromEvent(document, 'mousemove');
mouseDown
.map(event => mouseMove)
mouseDown
.map(event => mouseMove.takeUntil(mouseUp))
mouseDown
.map(event => mouseMove
mouseDown
.map(event => mouseMove.takeUntil(mouseUp))
.concatAll()
mouseDown
.map(event => mouseMove.takeUntil(mouseUp))
.concatAll()
.subscribe(event => {
dragDOM.style.left = event.clientX + 'px';
dragDOM.style.top = event.clientY + 'px';
})
https://jsbin.com/sanefic/1/edit?js,output
var isRequesting = false;
window.addEventListener('scroll', function() {
if(someOffsetBottom < 0 && !isRequesting) {
isRequesting = true;
fetch('url...')
.then(res => {
// do something change view
isRequesting = false;
})
}
})
var scroll = Observable.fromEvent(window, 'scroll');
scroll
.filter(event => someOffsetBottom < 0)
.map(event => fetch('url...'))
.exhaust()
.subscribe(res => {
// do something change view
})
RxJS
• Promise
• DOM Event
• AJAX
• WebSocket
• Server Sent Event
• Animation
• DOM Event (0 - N values)
• AJAX (1 value)
• WebSocket (0 - N values)
• Server Sent Event (0 - N values)
• Animation (0 - N values, )
Promise AJAX
• DOM Event (0 - N values)
• AJAX (1 value)
• WebSocket (0 - N values)
• Server Sent Event (0 - N values)
• Animation (0 - N values, )
Observable
• DOM Event (0 - N values)
• AJAX (1 value)
• WebSocket (0 - N values)
• Server Sent Event (0 - N values)
• Animation (0 - N values, )
RxJS
• Promise
• Observable ES7
• RxJS 5
• RxJS 5 Observable Spec Proposal
• framework (library) RxJS
• Angular 2
• Vue-rx
• Redux-Observable
RxJS
RxJS
• ( )
• ( )
•
•
•
RxJS
• Hello World app
•
• ( )
• RxJS
• 30 RxJS
• Observable Spec Proposal
• Learn RxJS
•
•
• AutoComplete
•
•

More Related Content

What's hot

DynamoDBを導入した話
DynamoDBを導入した話DynamoDBを導入した話
DynamoDBを導入した話
dcubeio
 
うちのRedmineの使い方(2)
うちのRedmineの使い方(2)うちのRedmineの使い方(2)
うちのRedmineの使い方(2)
Tomohisa Kusukawa
 
ある工場の Redmine 2022 〜ある工場の Redmine 5.0 バージョンアップ〜 ( Redmine of one plant 2022 ...
ある工場の Redmine 2022 〜ある工場の Redmine 5.0 バージョンアップ〜 (  Redmine of one plant 2022 ...ある工場の Redmine 2022 〜ある工場の Redmine 5.0 バージョンアップ〜 (  Redmine of one plant 2022 ...
ある工場の Redmine 2022 〜ある工場の Redmine 5.0 バージョンアップ〜 ( Redmine of one plant 2022 ...
Kohei Nakamura
 
Zshでデキるプロンプト
ZshでデキるプロンプトZshでデキるプロンプト
Zshでデキるプロンプト
Maruyama Tetsutaro
 
Redmineosaka 20 talk_crosspoints
Redmineosaka 20 talk_crosspointsRedmineosaka 20 talk_crosspoints
Redmineosaka 20 talk_crosspoints
Shinji Tamura
 
Webブラウザ上で動作する帳票エンジンを作る話
Webブラウザ上で動作する帳票エンジンを作る話Webブラウザ上で動作する帳票エンジンを作る話
Webブラウザ上で動作する帳票エンジンを作る話
terurou
 
Reladomoを使ったトランザクション履歴管理をプロダクトに適用した際のメリット/デメリット/課題など
Reladomoを使ったトランザクション履歴管理をプロダクトに適用した際のメリット/デメリット/課題などReladomoを使ったトランザクション履歴管理をプロダクトに適用した際のメリット/デメリット/課題など
Reladomoを使ったトランザクション履歴管理をプロダクトに適用した際のメリット/デメリット/課題など
なべ
 
GeoServer 기초
GeoServer 기초GeoServer 기초
GeoServer 기초
Seong geon Kim
 
GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현
GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현
GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현
MinPa Lee
 
PostgreSQL共有バッファと関連ツール
PostgreSQL共有バッファと関連ツールPostgreSQL共有バッファと関連ツール
PostgreSQL共有バッファと関連ツール
Masahiko Sawada
 
Go 製リアルタイムサーバーの Kubernetes での運用について
Go 製リアルタイムサーバーの  Kubernetes での運用についてGo 製リアルタイムサーバーの  Kubernetes での運用について
Go 製リアルタイムサーバーの Kubernetes での運用について
KairiOkumura
 
생각보다 쉬운 webGL - 인터렉티브에 저널리즘 녹이기
생각보다 쉬운 webGL - 인터렉티브에 저널리즘 녹이기생각보다 쉬운 webGL - 인터렉티브에 저널리즘 녹이기
생각보다 쉬운 webGL - 인터렉티브에 저널리즘 녹이기
NAVER Engineering
 
PHP AST 徹底解説
PHP AST 徹底解説PHP AST 徹底解説
PHP AST 徹底解説
do_aki
 
Dci vs aggregate_dddtw_2021-0.3-16-9
Dci vs aggregate_dddtw_2021-0.3-16-9Dci vs aggregate_dddtw_2021-0.3-16-9
Dci vs aggregate_dddtw_2021-0.3-16-9
teddysoft
 
Mojoliciousでつくる! Webアプリ入門
Mojoliciousでつくる! Webアプリ入門Mojoliciousでつくる! Webアプリ入門
Mojoliciousでつくる! Webアプリ入門
Yusuke Wada
 
Redmineを使ってみよう
Redmineを使ってみようRedmineを使ってみよう
Redmineを使ってみよう
mrgoofy33 .
 
공간정보아카데미 - 오픈소스GIS 분석가과정 - QGIS 공간분석일반
공간정보아카데미 - 오픈소스GIS 분석가과정 - QGIS 공간분석일반공간정보아카데미 - 오픈소스GIS 분석가과정 - QGIS 공간분석일반
공간정보아카데미 - 오픈소스GIS 분석가과정 - QGIS 공간분석일반
MinPa Lee
 
なぜ初心者は webpackが解らないのか?- Why can’t you understand the webpack? -
なぜ初心者は webpackが解らないのか?- Why can’t you understand the webpack? - なぜ初心者は webpackが解らないのか?- Why can’t you understand the webpack? -
なぜ初心者は webpackが解らないのか?- Why can’t you understand the webpack? -
健人 井関
 
まずやっとくPostgreSQLチューニング
まずやっとくPostgreSQLチューニングまずやっとくPostgreSQLチューニング
まずやっとくPostgreSQLチューニング
Kosuke Kida
 
すぐに分かる!プロジェクト計画の作り方
すぐに分かる!プロジェクト計画の作り方すぐに分かる!プロジェクト計画の作り方
すぐに分かる!プロジェクト計画の作り方
Eisuke Sugitani
 

What's hot (20)

DynamoDBを導入した話
DynamoDBを導入した話DynamoDBを導入した話
DynamoDBを導入した話
 
うちのRedmineの使い方(2)
うちのRedmineの使い方(2)うちのRedmineの使い方(2)
うちのRedmineの使い方(2)
 
ある工場の Redmine 2022 〜ある工場の Redmine 5.0 バージョンアップ〜 ( Redmine of one plant 2022 ...
ある工場の Redmine 2022 〜ある工場の Redmine 5.0 バージョンアップ〜 (  Redmine of one plant 2022 ...ある工場の Redmine 2022 〜ある工場の Redmine 5.0 バージョンアップ〜 (  Redmine of one plant 2022 ...
ある工場の Redmine 2022 〜ある工場の Redmine 5.0 バージョンアップ〜 ( Redmine of one plant 2022 ...
 
Zshでデキるプロンプト
ZshでデキるプロンプトZshでデキるプロンプト
Zshでデキるプロンプト
 
Redmineosaka 20 talk_crosspoints
Redmineosaka 20 talk_crosspointsRedmineosaka 20 talk_crosspoints
Redmineosaka 20 talk_crosspoints
 
Webブラウザ上で動作する帳票エンジンを作る話
Webブラウザ上で動作する帳票エンジンを作る話Webブラウザ上で動作する帳票エンジンを作る話
Webブラウザ上で動作する帳票エンジンを作る話
 
Reladomoを使ったトランザクション履歴管理をプロダクトに適用した際のメリット/デメリット/課題など
Reladomoを使ったトランザクション履歴管理をプロダクトに適用した際のメリット/デメリット/課題などReladomoを使ったトランザクション履歴管理をプロダクトに適用した際のメリット/デメリット/課題など
Reladomoを使ったトランザクション履歴管理をプロダクトに適用した際のメリット/デメリット/課題など
 
GeoServer 기초
GeoServer 기초GeoServer 기초
GeoServer 기초
 
GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현
GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현
GeoTools와 GeoServer를 이용한 KOPSS Open API의 구현
 
PostgreSQL共有バッファと関連ツール
PostgreSQL共有バッファと関連ツールPostgreSQL共有バッファと関連ツール
PostgreSQL共有バッファと関連ツール
 
Go 製リアルタイムサーバーの Kubernetes での運用について
Go 製リアルタイムサーバーの  Kubernetes での運用についてGo 製リアルタイムサーバーの  Kubernetes での運用について
Go 製リアルタイムサーバーの Kubernetes での運用について
 
생각보다 쉬운 webGL - 인터렉티브에 저널리즘 녹이기
생각보다 쉬운 webGL - 인터렉티브에 저널리즘 녹이기생각보다 쉬운 webGL - 인터렉티브에 저널리즘 녹이기
생각보다 쉬운 webGL - 인터렉티브에 저널리즘 녹이기
 
PHP AST 徹底解説
PHP AST 徹底解説PHP AST 徹底解説
PHP AST 徹底解説
 
Dci vs aggregate_dddtw_2021-0.3-16-9
Dci vs aggregate_dddtw_2021-0.3-16-9Dci vs aggregate_dddtw_2021-0.3-16-9
Dci vs aggregate_dddtw_2021-0.3-16-9
 
Mojoliciousでつくる! Webアプリ入門
Mojoliciousでつくる! Webアプリ入門Mojoliciousでつくる! Webアプリ入門
Mojoliciousでつくる! Webアプリ入門
 
Redmineを使ってみよう
Redmineを使ってみようRedmineを使ってみよう
Redmineを使ってみよう
 
공간정보아카데미 - 오픈소스GIS 분석가과정 - QGIS 공간분석일반
공간정보아카데미 - 오픈소스GIS 분석가과정 - QGIS 공간분석일반공간정보아카데미 - 오픈소스GIS 분석가과정 - QGIS 공간분석일반
공간정보아카데미 - 오픈소스GIS 분석가과정 - QGIS 공간분석일반
 
なぜ初心者は webpackが解らないのか?- Why can’t you understand the webpack? -
なぜ初心者は webpackが解らないのか?- Why can’t you understand the webpack? - なぜ初心者は webpackが解らないのか?- Why can’t you understand the webpack? -
なぜ初心者は webpackが解らないのか?- Why can’t you understand the webpack? -
 
まずやっとくPostgreSQLチューニング
まずやっとくPostgreSQLチューニングまずやっとくPostgreSQLチューニング
まずやっとくPostgreSQLチューニング
 
すぐに分かる!プロジェクト計画の作り方
すぐに分かる!プロジェクト計画の作り方すぐに分かる!プロジェクト計画の作り方
すぐに分かる!プロジェクト計画の作り方
 

Similar to You will learn RxJS in 2017

RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術
名辰 洪
 
Reactive programming with RxJS - ByteConf 2018
Reactive programming with RxJS - ByteConf 2018Reactive programming with RxJS - ByteConf 2018
Reactive programming with RxJS - ByteConf 2018
Tracy Lee
 
Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.
Astrails
 
Angular2 rxjs
Angular2 rxjsAngular2 rxjs
Angular2 rxjs
Christoffer Noring
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
Brian Lonsdorf
 
Rxjs ngvikings
Rxjs ngvikingsRxjs ngvikings
Rxjs ngvikings
Christoffer Noring
 
Javascript
JavascriptJavascript
Javascript
Vlad Ifrim
 
Rxjs kyivjs 2015
Rxjs kyivjs 2015Rxjs kyivjs 2015
Rxjs kyivjs 2015
Alexander Mostovenko
 
Advanced jQuery
Advanced jQueryAdvanced jQuery
Advanced jQuery
sergioafp
 
Programmation fonctionnelle en JavaScript
Programmation fonctionnelle en JavaScriptProgrammation fonctionnelle en JavaScript
Programmation fonctionnelle en JavaScript
Loïc Knuchel
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScript
kvangork
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascript
kvangork
 
Road to react hooks
Road to react hooksRoad to react hooks
Road to react hooks
Younes (omar) Meliani
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGL
gerbille
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
Bruno Scopelliti
 
rx.js make async programming simpler
rx.js make async programming simplerrx.js make async programming simpler
rx.js make async programming simplerAlexander Mostovenko
 
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
GeeksLab Odessa
 
ES6(ES2015) is beautiful
ES6(ES2015) is beautifulES6(ES2015) is beautiful
ES6(ES2015) is beautiful
monikagupta18jan
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring CanvasKevin Hoyt
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
Visual Engineering
 

Similar to You will learn RxJS in 2017 (20)

RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術
 
Reactive programming with RxJS - ByteConf 2018
Reactive programming with RxJS - ByteConf 2018Reactive programming with RxJS - ByteConf 2018
Reactive programming with RxJS - ByteConf 2018
 
Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.
 
Angular2 rxjs
Angular2 rxjsAngular2 rxjs
Angular2 rxjs
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
 
Rxjs ngvikings
Rxjs ngvikingsRxjs ngvikings
Rxjs ngvikings
 
Javascript
JavascriptJavascript
Javascript
 
Rxjs kyivjs 2015
Rxjs kyivjs 2015Rxjs kyivjs 2015
Rxjs kyivjs 2015
 
Advanced jQuery
Advanced jQueryAdvanced jQuery
Advanced jQuery
 
Programmation fonctionnelle en JavaScript
Programmation fonctionnelle en JavaScriptProgrammation fonctionnelle en JavaScript
Programmation fonctionnelle en JavaScript
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScript
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascript
 
Road to react hooks
Road to react hooksRoad to react hooks
Road to react hooks
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGL
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
 
rx.js make async programming simpler
rx.js make async programming simplerrx.js make async programming simpler
rx.js make async programming simpler
 
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
WebCamp:Front-end Developers Day. Александр Мостовенко "Rx.js - делаем асинхр...
 
ES6(ES2015) is beautiful
ES6(ES2015) is beautifulES6(ES2015) is beautiful
ES6(ES2015) is beautiful
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 

You will learn RxJS in 2017

  • 1. You Will Learn RxJS In 2017 Jerry Hong
  • 3. ...
  • 4. • RxJS ? Lodash ? • RxJS ?
  • 5. var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } })
  • 6. var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } }) var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } }) var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } }) var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } }) var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } }) var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } })
  • 7. var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } }) ...
  • 8. var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } }) Callback
  • 9. var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } }) Promise
  • 10. var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } }) Complex State
  • 11.
  • 13. [1, 2, 3].forEach(x => console.log(x)); 1 2 3 ForEach
  • 14. [1, 2, 3].map(x => x + 1); [2, 3, 4] Map
  • 15. [1, 2, 3].filter(x => x % 2 === 1); [1, 3] Filter
  • 16. [[1, 2], [2, 3], [5, 6]].concatAll(); [1, 2, 2, 3, 5, 6] concatAll
  • 17.
  • 18. var user = { id: 888, name: 'JerryHong', courseLists: [{ name: 'My Courses', courses: [ { title: 'React ', rating: 5 }, { title: ' ', rating: 4 } ] }, { name: 'New Release', courses: [ { title: 'Vue 2 ', rating: 5 }, { title: 'RxJS ', rating: 5 } ] }] }; var user = { id: 888, name: 'JerryHong', courseLists: [{ name: 'My Courses', courses: [ { title: 'React ', rating: 5 }, { title: ' ', rating: 4 } ] }, { name: 'New Release', courses: [ { title: 'Vue 2 ', rating: 5 }, { title: 'RxJS ', rating: 5 } ] }] }; var user = { id: 888, name: 'JerryHong', courseLists: [{ name: 'My Courses', courses: [ { title: 'React ', rating: 5 }, { title: ' ', rating: 4 } ] }, { name: 'New Release', courses: [ { title: 'Vue 2 ', rating: 5 }, { title: 'RxJS ', rating: 5 } ] }] };
  • 19. var user = { id: 888, name: 'JerryHong', courseLists: [{ name: 'My Courses', courses: [ { title: 'React ', rating: 5 }, { title: ' ', rating: 4 } ] }, { name: 'New Release', courses: [ { title: 'Vue 2 ', rating: 5 }, { title: 'RxJS ', rating: 5 } ] }] };
  • 20. user.courseLists .map(courseList => courseList.courses .filter(course => course.rating === 5)) .concatAll() .forEach(course => console.log(course)) rating 5
  • 22. ... [{x: 31, y: 23}, {x: 41, y: 23}, {x: 12, y: 45}]
  • 23. {x: 31, y: 23}...{x: 41, y: 23}...{x: 12, y: 45}
  • 25.
  • 26.
  • 28. var iterator = [1, 2, 3][Symbol.iterator](); iterator.next(); { value: 1, done: false } iterator.next(); { value: 2, done: false } iterator.next(); { value: 3, done: false } iterator.next(); { value: undefined, done: true } Iterator
  • 30. document.addEventListener(
 'mousemove', 
 function next(event){
 console.log(event)
 }) { clientX: 55, clientY: 121 } { clientX: 12, clientY: 124 } { clientX: 23, clientY: 234 } { clientX: 234, clientY: 12 } { clientX: 123, clientY: 45 } { clientX: 56, clientY: 133 } Observer
  • 32. document.addEventListener('click', (event) => { ... }) Push var x = iterator.next() Pull
  • 33. Push API • DOM Events • Web sockets • Node Streams • XMLHttpRequest • setInterval • Service Workers
  • 36. var mouseMove = Observable .fromEvent(elem, 'mousemove') Observable for Event
  • 37. API • DOM Events • Web sockets • Node Streams • XMLHttpRequest • setInterval • Service Workers => Observable
  • 38. var handler = (event) => console.log(event) // subscribe document.addEventListener('mousemove', handler) // unsubscribe document.removeEventListener('mousemove', handler)
  • 39. // subscribe var subscription = mouseMove.subscribe(console.log) // unsubscribe subscription.unsubscribe() Observable
  • 40. // subscribe mouseMove.subscribe( event => console.log(event), err => console.log('Error: ' + err), () => console.log('complete') ) // unsubscribe mouseMove.unsubscribe() Observable
  • 43. '--1----2---3'.map(x => x + 1); 2 3 4 Map
  • 44. '--1----2---3'.filter(x => x % 2 === 1); 1 3 Filter
  • 45. [[1, 2], [2, 3], [5, 6]].concatAll(); [1, 2, 2, 3, 5, 6] concatAll
  • 46. '--o-------o'.concatAll();
 
 -1--2| -1-2-3| 1 2 1 2 3 concatAll '---1--2---1-2-3'
  • 48. const dragDOM = document.getElementById('drag'); const mouseDown = Observable .fromEvent(dragDOM, 'mousedown'); const mouseUp = Observable .fromEvent(document, 'mouseup'); const mouseMove = Observable .fromEvent(document, 'mousemove');
  • 49. mouseDown .map(event => mouseMove) mouseDown .map(event => mouseMove.takeUntil(mouseUp)) mouseDown .map(event => mouseMove mouseDown .map(event => mouseMove.takeUntil(mouseUp)) .concatAll() mouseDown .map(event => mouseMove.takeUntil(mouseUp)) .concatAll() .subscribe(event => { dragDOM.style.left = event.clientX + 'px'; dragDOM.style.top = event.clientY + 'px'; }) https://jsbin.com/sanefic/1/edit?js,output
  • 50. var isRequesting = false; window.addEventListener('scroll', function() { if(someOffsetBottom < 0 && !isRequesting) { isRequesting = true; fetch('url...') .then(res => { // do something change view isRequesting = false; }) } })
  • 51. var scroll = Observable.fromEvent(window, 'scroll'); scroll .filter(event => someOffsetBottom < 0) .map(event => fetch('url...')) .exhaust() .subscribe(res => { // do something change view })
  • 53. • DOM Event • AJAX • WebSocket • Server Sent Event • Animation • DOM Event (0 - N values) • AJAX (1 value) • WebSocket (0 - N values) • Server Sent Event (0 - N values) • Animation (0 - N values, )
  • 54. Promise AJAX • DOM Event (0 - N values) • AJAX (1 value) • WebSocket (0 - N values) • Server Sent Event (0 - N values) • Animation (0 - N values, )
  • 55. Observable • DOM Event (0 - N values) • AJAX (1 value) • WebSocket (0 - N values) • Server Sent Event (0 - N values) • Animation (0 - N values, )
  • 56. RxJS • Promise • Observable ES7 • RxJS 5 • RxJS 5 Observable Spec Proposal • framework (library) RxJS • Angular 2 • Vue-rx • Redux-Observable
  • 57. RxJS
  • 58. RxJS • ( ) • ( ) • • •
  • 59. RxJS • Hello World app • • ( )
  • 60. • RxJS • 30 RxJS • Observable Spec Proposal • Learn RxJS