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
How callbacks in JavaScript really work
Search
Jesstern Rays
December 15, 2015
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How callbacks in JavaScript really work
Understanding how JavaScript actually handles asynchronous callbacks.
Jesstern Rays
December 15, 2015
Other Decks in Programming
See All in Programming
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.5k
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
590
golang-bob.pdf
iwatsukayura
0
130
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
最近”作らせてる” ローカルAIアプリの話
akit37
0
470
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2k
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.2k
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
すこし踏み込む CancellationToken
htkym
2
1.7k
Featured
See All Featured
Thoughts on Productivity
jonyablonski
76
5.4k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
59k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
Unsuck your backbone
ammeep
672
58k
Producing Creativity
orderedlist
PRO
348
41k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
600
Transcript
@jsstrn Jesstern Rays
callbacks
analogy
butler
make me a sandwich
two ways to do this
first way
first way wait for butler to make sandwich
first way blocking wait for butler to make sandwich
first way blocking synchronous wait for butler to make sandwich
second way
second way butler makes sandwich; we do something else
second way butler makes sandwich; we do something else butler
calls us back when its done
second way non-blocking butler makes sandwich; we do something else
butler calls us back when its done
second way non-blocking asynchronous butler makes sandwich; we do something
else butler calls us back when its done
but JavaScript is single threaded
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0)
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0) fn()
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0) fn() console.log()
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0) fn()
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0)
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0)
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0) setTimeout(fn,0)
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0)
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0)
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0) fn()
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0) fn() console.log()
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0) fn()
app.js call stack fn() function fn () { console.log(‘You called?’)
} setTimeout(fn, 0)
how async callbacks really work
What the heck is the event loop anyway? by Philip
Roberts
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0)
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0) fn()
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0) fn() console.log()
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0) fn()
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0)
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0)
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0) setTimeout(fn,0)
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0)
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0) setTimeout(fn,0)
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0)
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0) fn()
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0)
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0)
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0) fn()
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0) fn() console.log()
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0) fn()
app.js call stack web apis callback queue event loop fn()
function fn () { console.log(‘You called?’) } setTimeout(fn, 0)
thank you
@jsstrn Jesstern Rays
references What the heck is the event loop anyway? by
Philip Roberts Philip Robert’s "loupe"
image credits Waiter by Scott Lewis from the Noun Project
Sandwich by Tom Glass, Jr. from the Noun Project