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
370
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
DOM Observable
福岡フロントエンド勉強会 #1
https://connpass.com/event/311524/
petamoriken / 森建
March 15, 2024
More Decks by petamoriken / 森建
See All by petamoriken / 森建
WebAssembly を読み込むベストプラクティス 2026年春版 / Best Practices for Loading WebAssembly (Spring 2026)
petamoriken
5
1.2k
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
260
Module Harmony
petamoriken
3
1k
Denoでフロントエンド開発 2025年春版 / Frontend Development with Deno (Spring 2025)
petamoriken
1
1.6k
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
660
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
330
フロントエンドの標準仕様をどう追っているか / How I follow the frontend standards specs
petamoriken
4
2.7k
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
660
Deno に Web 標準 API を実装する / Implementing Web standards API to Deno
petamoriken
0
840
Other Decks in Programming
See All in Programming
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
270
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.7k
LLM Plugin for Node-REDの利用方法と開発について
404background
0
170
Contextとはなにか
chiroruxx
1
300
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
160
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
110
Claspは野良GASの夢をみるか
takter00
0
190
net-httpのHTTP/2対応について
naruse
0
480
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
160
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.5k
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
140
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
Featured
See All Featured
Designing for Timeless Needs
cassininazir
1
250
Game over? The fight for quality and originality in the time of robots
wayneb77
1
200
For a Future-Friendly Web
brad_frost
183
10k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
220
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
We Have a Design System, Now What?
morganepeng
55
8.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Building Adaptive Systems
keathley
44
3k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
160
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
140
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
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 へ!