Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
throttleすげぇぇぇ
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Sigma
October 10, 2022
Programming
95
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
throttleすげぇぇぇ
Sigma
October 10, 2022
Transcript
10 slides
throttleがすごい話 Vueのリアクティブシステム
NLP のしぐまです! • 株式会社エヌエルプラスに去年入社しました。 ◦ リファラル採用やってます! • 自分はイベント配信プラットフォーム (受託) 等やってます。
• 現在は主にNuxtとGoとGCPを触っています。 ◦ フルスタックです!何でも屋とも言う…なぜかGoも触ってる… • シニアエンジニアです。
Vueのリアクティブシステム
変数の書き換えが速さがいやらしい場合 • 変数の書き換えに反応して重たい描画機能が走っている場合。書き換えの速さに よって死ぬ。 ◦ 経験したケースでは秒間数十回走るとつらい。 ◦ 高速なチャットとか。 • throttle
で書き換え回数を制限してしまえば安定するのではないか?
throttleの概要 • 関数の実行回数をNミリ秒に一回に制限できる。 ◦ 500 ミリ秒なら秒間 2 回 • Nミリ秒内の実行は無視されず、次の実行可能タイミングに実行される。
• lodashに入ってる
どう制限するか • ウォッチャに throttle で ラップした update 関数 を仕込み、更新回数の 制限された変数を実際
にその変数を描画する コンポーネントに渡す。 DRAW COMPONENT throttled variable: drawするコンポーネントへ渡 す。 update function: throttled variableを更新 watch: callback に throttle update function, 高速 で更新される store の変数を watch STORE
こんな感じ
lodash の throttle が優秀 • 公式ドキュメントから参照され ていた記事 https://css-tricks.com/debou ncing-throttling-explained-e xamples/
にあるデモを一部 throttle 用に書き換えた。
ユースケース(throttle, debounce) • 複数回の誤クリックの対策 • スクロールイベント等の制限 • リアクティブシステムの暴走を止める
イベント駆動な JavaScript を制する
More Decks by Sigma
See All by Sigma
Proxmox_VE.pdf
seiyasugimoto
0
250
Stable Diffusionで遊んでみた
seiyasugimoto
1
160
EVAフレームワーク
seiyasugimoto
0
130
SSR+SPA
seiyasugimoto
0
170
Nuxtにおける設計
seiyasugimoto
0
110
Atomic Designを ディレクトリ以外で表現
seiyasugimoto
0
100
スマホでPythonしたい
seiyasugimoto
0
83
平文で保存するな!
seiyasugimoto
0
110
ソースコードを読もう
seiyasugimoto
0
110
Other Decks in Programming
See All in Programming
AI駆動TDD ― 2026年10月版
hrmstrsmgs
0
110
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
390
JavaScriptはシングルバイナリの夢を見るか / Does JavaScript Dream of a Single Binary?
ssssota
0
200
joyful-journey-spring-boot.pdf
hollycummins
0
110
Scalaの型でマルチテナントの認可を守る
nextbeatdev
0
180
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
830
正解の無い問題を 「できるだけ上手く」解く ヒューリスティックで感性を磨こう。〜現実課題をプログラミングで解きあうコミュニティについて〜
allegrogiken
0
110
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
700
LLM 101: Exploring LLMs, Starting with Tokens.
dalinaum
0
120
エージェントの管理もエージェントに – herdr-core と自作バックログで作る司令塔 –
nearme_tech
PRO
2
150
AI Augmentation Techniques with Liberty
ivargrimstad
1
570
LLM 101
dalinaum
0
540
Featured
See All Featured
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
350
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.5k
Designing for Timeless Needs
cassininazir
1
570
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
2
160
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
490
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
How STYLIGHT went responsive
nonsquared
100
6.4k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
390
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
620
Test your architecture with Archunit
thirion
2
2.5k
The browser strikes back
jonoalderson
0
2k
Abbi's Birthday
coloredviolet
5
11k