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
85
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
680
Multithreading WebAssembly by Rust
petamoriken
3
920
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
490
Other Decks in Programming
See All in Programming
初心者のためのRubyKaigi入門/RubyKaigi Introduction
a_matsuda
3
910
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
0
260
Snowflakeで眠ったデータを起こそう!
estie
0
120
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
340
What We Can Learn From OSS
inouehi
0
420
Ruby GitHub Packages
bkuhlmann
0
630
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
120
雑に思考を整理する技術と効能
konifar
60
29k
0→1と1→10の狭間で Javaという技術選定を振り返る/Reflecting on the Decision to Choose Java Between Scaling from 0 to 1 and 1 to 10
jaguar_imo
2
380
AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips
gotok365
2
200
Ruby Pattern Matching
bkuhlmann
0
930
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
340
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
4 Signs Your Business is Dying
shpigford
175
21k
Embracing the Ebb and Flow
colly
80
4.1k
Designing for Performance
lara
601
67k
Being A Developer After 40
akosma
57
580k
Building Applications with DynamoDB
mza
88
5.6k
The Mythical Team-Month
searls
216
42k
Facilitating Awesome Meetings
lara
42
5.6k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
Rebuilding a faster, lazier Slack
samanthasiow
73
8.2k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
78
43k
Building an army of robots
kneath
300
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 へ!