Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DOM Observable
Search
petamoriken / 森建
March 15, 2024
Programming
1
290
DOM Observable
福岡フロントエンド勉強会 #1
https://connpass.com/event/311524/
petamoriken / 森建
March 15, 2024
Tweet
Share
More Decks by petamoriken / 森建
See All by petamoriken / 森建
Module Harmony
petamoriken
2
610
Denoでフロントエンド開発 2025年春版 / Frontend Development with Deno (Spring 2025)
petamoriken
1
1.5k
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
590
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
270
フロントエンドの標準仕様をどう追っているか / How I follow the frontend standards specs
petamoriken
4
2.4k
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
590
Deno に Web 標準 API を実装する / Implementing Web standards API to Deno
petamoriken
0
730
Contributing to Deno is fun!
petamoriken
0
400
Stage 2 Decorators の変遷 / Stage 2 Decorators history
petamoriken
0
7.1k
Other Decks in Programming
See All in Programming
TypeScriptで設計する 堅牢さとUXを両立した非同期ワークフローの実現
moeka__c
6
2.9k
Reactive Thinking with Signals and the new Resource API
manfredsteyer
PRO
0
160
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
120
sbt 2
xuwei_k
0
190
エディターってAIで操作できるんだぜ
kis9a
0
650
AIコーディングエージェント(Manus)
kondai24
0
120
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
5
2.1k
【CA.ai #3】ワークフローから見直すAIエージェント — 必要な場面と“選ばない”判断
satoaoaka
0
210
俺流レスポンシブコーディング 2025
tak_dcxi
13
7.7k
Why Kotlin? 電子カルテを Kotlin で開発する理由 / Why Kotlin? at Henry
agatan
2
6.2k
「文字列→日付」の落とし穴 〜Ruby Date.parseの意外な挙動〜
sg4k0
0
360
GeistFabrik and AI-augmented software development
adewale
PRO
0
250
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Scaling GitHub
holman
464
140k
Designing Experiences People Love
moore
142
24k
Six Lessons from altMBA
skipperchong
29
4.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Docker and Python
trallard
46
3.7k
Why You Should Never Use an ORM
jnunemaker
PRO
60
9.6k
Site-Speed That Sticks
csswizardry
13
990
How to train your dragon (web standard)
notwaldorf
97
6.4k
A designer walks into a library…
pauljervisheath
210
24k
Navigating Team Friction
lara
191
16k
GitHub's CSS Performance
jonrohan
1032
470k
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 へ!