Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DOM Observable
Search
petamoriken / 森建
March 15, 2024
Programming
1
92
DOM Observable
福岡フロントエンド勉強会 #1
https://connpass.com/event/311524/
petamoriken / 森建
March 15, 2024
Tweet
Share
More Decks by petamoriken / 森建
See All by petamoriken / 森建
Deno に Web 標準 API を実装する / Implementing Web Standard API to Deno
petamoriken
0
390
Contributing to Deno is fun!
petamoriken
0
170
Stage 2 Decorators の変遷 / Stage 2 Decorators history
petamoriken
0
5.8k
linaria: Zero-Runtime CSS in JS
petamoriken
2
2k
ESNext の議論に参加しよう / Join the ESNext discussion
petamoriken
3
690
Multithreading WebAssembly by Rust
petamoriken
3
930
WebAssembly で WebP のデコードを試した / Decode WebP with WebAssembly by Pure Rust
petamoriken
0
1k
TC39 で提案されている ECMAScript 最新仕様 / ECMAScript latest specification proposed in TC39
petamoriken
2
740
バイト列から整数を得る
petamoriken
1
500
Other Decks in Programming
See All in Programming
初心者のためのRubyKaigi入門/RubyKaigi Introduction
a_matsuda
10
1.7k
Git Rebase
bkuhlmann
11
1.6k
The Cutting Edge Of Versioning (LambdaConf 2024)
chriskrycho
0
230
Docker_OSS_ホスティング入門
satokoki645
0
110
Kotlin Multiplatform at Stable and Beyond (Android Makers 2024)
zsmb
0
550
Ruby Pattern Matching
bkuhlmann
0
940
Elm 0.19.0 Changes
bkuhlmann
0
510
ペパボOpenTelemetry革命
pyama86
2
180
Scalable Customer Journey Orchestration (CJO)
lewuathe
0
450
AppRouter Panel Talk
yosuke_furukawa
PRO
1
500
Implementing Design Systems in Swift
seyfoyun
2
500
Open standards for building event-driven applications in the cloud
meteatamel
0
190
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
22
1.6k
4 Signs Your Business is Dying
shpigford
176
21k
KATA
mclloyd
16
12k
The Art of Programming - Codeland 2020
erikaheidi
43
12k
Web development in the modern age
philhawksworth
203
10k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
21
1.6k
What's new in Ruby 2.0
geeforr
337
31k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
104
6.6k
Debugging Ruby Performance
tmm1
70
11k
Thoughts on Productivity
jonyablonski
60
3.9k
Side Projects
sachag
451
41k
Transcript
DOM Observable 福岡フロントエンド勉強会 #1 pixiv Inc. 森内建太 petamoriken 2024.3.15
2 自己紹介 • Web エンジニア • ECMAScript や WHATWG を追うのが好き • 最近 Float16Array が SpiderMonkey, V8 に入った! petamoriken
カスタマーオペレーション &セーフティ本部 オペレーション開発部
3 目次 • JavaScript におけるストリーム • Observable とは • DOM Observable の提案 •
RxJS との違い • 細かい話
4 JavaScript におけるストリーム • Pull ストリーム ◦ Iterator, AsyncIterator (ECMAScript) ◦ ReadableStream
(Streams Standard) • Push ストリーム ◦ EventTarget (DOM Standard) ▪ 一応ストリームとして扱えるがどちらかといえばイベント
5 Observable とは • Push ストリームのライブラリ実装 ◦ JS だと RxJS が一番有名
6 DOM Observable の提案 • TC39 の方で標準化を進めていたが5年くらい音沙汰がなかった • RxJS コアチームリードの Ben Lesh さんが Web 側で標準化する提案を出した
7 DOM Observable の提案
8 RxJS との違い • RxJS の Hot Observable を作る機能はない • クリーンアップの処理のコールバックの渡し方が違う • RxJS は fromEvent 函数で変換するが、直接 EventTarget にメソッドが生える ◦
EventTarget#on が提案されていたが Break the Web で駄目 😭 ◦ EventTarget#observe は IntersectionObserver 等と型が違うから微妙
9 細かい話 • Observable#subscribe のコールバックは同期的に実行される ◦ Promise#then や await ではマイクロタスクになるため非同期になる ◦ Observable を非同期にしちゃうと Event#preventDefault が呼べなくなっちゃう 👉 Promise に変換するときに要注意!
10 詳しくは Zenn へ!