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
89
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
Deep Dive into React Stream/Serialize
mugi_uno
3
740
Going beyond Apache Parquet's default settings
xhochy
0
140
Goのmultiple errorsについて (2024年4月版)
syumai
4
1.2k
スキーマ駆動開発による品質とスピードの両立 - 私達は何故、スキーマを書くのか
kentaroutakeda
0
180
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
480
雑に思考を整理する技術と効能
konifar
64
31k
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
680
WebGLで始める コンピュータグラフィックス入門
heller77
0
330
Snowflakeで眠ったデータを起こそう!
estie
0
160
Netty Chicago Java User Group 2024-04-17
sullis
0
210
Fast JSX: Don't clone props object #28768
yossydev
1
200
Go製Webアプリケーションのエラーとの向き合い方大全、あるいはやっぱりスタックトレース欲しいやん / Kyoto.go #50
utgwkk
6
1.8k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
689
190k
Building Effective Engineering Teams - LeadDev
addyosmani
32
1.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
356
18k
Embracing the Ebb and Flow
colly
80
4.2k
Scaling GitHub
holman
457
140k
Raft: Consensus for Rubyists
vanstee
133
6.3k
Designing on Purpose - Digital PM Summit 2013
jponch
111
6.5k
Web development in the modern age
philhawksworth
203
10k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Web Components: a chance to create the future
zenorocha
306
41k
Side Projects
sachag
451
41k
Gamification - CAS2011
davidbonilla
77
4.6k
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 へ!