SlideShare a Scribd company logo
Event Loop
In Browser
Anupam Poria
https://www.linkedin.com/in/anupam-poria-5b9ab957/
Event Loop
● How HTML is rendered in the browser?
● What is the event loop?
● Why it's important?
● How does it work?
Agenda
Internal structure of the browser
User Interface
Browser Engine
Rendering Engine
Storage
networking JS engine UI backend
User interface: The user interface includes the
address bar, back/forward button, bookmarking
menu, etc. Every part of the browser display
except the window where you see the
requested page.
Browser engine: The browser engine
marshals actions between the UI and the
rendering engine.
Rendering engine: The rendering engine is
responsible for displaying the requested
content.
Data storage: The data storage is a
persistence layer (cookies, localStorage,
IndexedDB, WebSQL, and FileSystem).
UI backend: It'd used for drawing basic
widgets. This backend exposes a generic
interface. Underneath it uses operating system
user interface methods.
Browser Workflow
Byte
Character
Tokens
Nodes
Dom
3c626f64793e3c6469763e48656c6c6f3c2f6469763e3c2f62
6f64793e
<body><div>Hello</div></body><body><div>Hello</div></body>
StartTag:body StartTag:div Hello EndTag:div EndTag:body
Tokenize
r
Body Hello Div
body
div
Hello
TreeBuilder
Call Stack
function getBar() {
console.log('done')
setTimeout(() => {
console.log('Wao!')
},1000);
}
function getFoo() {
getBar();
}
getFoo();
getFoo()
function getFoo(){
getBar();
}
function getBar() {
console.log('done')
}
done
Call Stack
Event loop in browser
Call Stack
function getBar() {
console.log('done')
setTimeout(() => {
console.log('Wao!')
},1000);
}
function getFoo() {
getBar();
}
getFoo();
Done
Wao!
Heap
Event Loop
setTimeout
new Promise
AJAX
etc..
resolve()
reject()
callback()
callback()
callback()
60 frame/s
One
callback()
Full job
queue()
May be re
render ……...
callstack
V8 runtime
code
code
code Web APIs
Job queue Event queue
Render queue
Main Thread
Event loop pseudo code
while (true) {
queue = getNextQueue();
task = queue.pop();
process(task);
while (microTasksQueue.hasTasks()) {
processMicroTask();
}
if (isRepaintTime()) {
doPaint();
}
}
Thank You

More Related Content

PPTX
JS Event Loop
PPTX
Class18
PPTX
Socrates Overview
PPTX
JavaScript Engines and Event Loop
PPTX
DOM & Events
PDF
Javascript Browser Events.pdf
PDF
Fast Cordova applications
DOCX
How Browsers Work -By Tali Garsiel and Paul Irish
JS Event Loop
Class18
Socrates Overview
JavaScript Engines and Event Loop
DOM & Events
Javascript Browser Events.pdf
Fast Cordova applications
How Browsers Work -By Tali Garsiel and Paul Irish

Similar to Event loop in browser (20)

PDF
An introduction to node3
PPTX
Node js for backend server development.
PPT
Scripting The Dom
KEY
Events
PDF
JavaScript DOM & event
PDF
Speeding up mobile web apps
PPTX
DOM Events
PPT
The Theory Of The Dom
PDF
"Leveraging the Event Loop for Blazing-Fast Applications!", Michael Di Prisco
PPTX
A beginner's guide to eventloops in node
PDF
Understanding the nodejs event loop
PDF
Introjs10.5.17SD
PPTX
Javascript why what and how
PPTX
Upstate CSCI 450 WebDev Chapter 4
PDF
Javascript
PPTX
JavaScript patterns chapter 8 of mine
PDF
Javascript info Ebook Part 1 The JavaScript language 1st Edition Ilya Kantor
PPTX
Document Object Model
PPT
Javascript dom event
PDF
Introducing jQuery
An introduction to node3
Node js for backend server development.
Scripting The Dom
Events
JavaScript DOM & event
Speeding up mobile web apps
DOM Events
The Theory Of The Dom
"Leveraging the Event Loop for Blazing-Fast Applications!", Michael Di Prisco
A beginner's guide to eventloops in node
Understanding the nodejs event loop
Introjs10.5.17SD
Javascript why what and how
Upstate CSCI 450 WebDev Chapter 4
Javascript
JavaScript patterns chapter 8 of mine
Javascript info Ebook Part 1 The JavaScript language 1st Edition Ilya Kantor
Document Object Model
Javascript dom event
Introducing jQuery
Ad

More from valuebound (20)

PDF
Scaling Drupal for High Traffic Websites
PDF
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
PDF
How to Use DDEV to Streamline Your Drupal Development Process.
PDF
How to Use AWS to Automate Your IT Operation| Valuebound
PDF
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
PDF
Mastering Drupal Theming
PDF
The Benefits of Cloud Engineering
PDF
Cloud Computing
PDF
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
PDF
Deep dive into ChatGPT
PDF
Content Creation Solution | Valuebound
PPTX
Road ahead for Drupal 8 contributed projects
PPTX
Chatbot with RASA | Valuebound
PDF
Drupal and Artificial Intelligence for Personalization
PPTX
Drupal growth in last year | Valuebound
PPTX
BE NEW TO THE WORLD "BRAVE FROM CHROME"
PPTX
The Basics of MongoDB
PPTX
React JS: A Secret Preview
PPTX
Dependency Injection in Drupal 8
PPTX
An Overview of Field Collection Views Module
Scaling Drupal for High Traffic Websites
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
How to Use DDEV to Streamline Your Drupal Development Process.
How to Use AWS to Automate Your IT Operation| Valuebound
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
Mastering Drupal Theming
The Benefits of Cloud Engineering
Cloud Computing
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
Deep dive into ChatGPT
Content Creation Solution | Valuebound
Road ahead for Drupal 8 contributed projects
Chatbot with RASA | Valuebound
Drupal and Artificial Intelligence for Personalization
Drupal growth in last year | Valuebound
BE NEW TO THE WORLD "BRAVE FROM CHROME"
The Basics of MongoDB
React JS: A Secret Preview
Dependency Injection in Drupal 8
An Overview of Field Collection Views Module
Ad

Recently uploaded (20)

PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
Teaching material agriculture food technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation theory and applications.pdf
PDF
Modernizing your data center with Dell and AMD
PPTX
Cloud computing and distributed systems.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Teaching material agriculture food technology
Spectral efficient network and resource selection model in 5G networks
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MYSQL Presentation for SQL database connectivity
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation theory and applications.pdf
Modernizing your data center with Dell and AMD
Cloud computing and distributed systems.
Building Integrated photovoltaic BIPV_UPV.pdf
Encapsulation_ Review paper, used for researhc scholars
Network Security Unit 5.pdf for BCA BBA.
NewMind AI Weekly Chronicles - August'25 Week I
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Understanding_Digital_Forensics_Presentation.pptx

Event loop in browser