SlideShare a Scribd company logo
Tutorial - 6
• Revision of yesterday lecture
• Create a mini project of a simple calculator
• Create a mini project of todo lis
• What is JSON
• Event loop
• Event loop examples
• callback-queue
• API
• async calls
• setTimeout
• fetch
• Promise
Event loop
• Any execution happening in JS is taken care of by its
property of being "single threaded synchronous
language"
• And in order to achieve that we have Execution
Context
• But sometimes we have scenarios of handling the
call back functions or promises where the
behaviour of EC is not regular in order to maintain
JS core value of single threaded + sync. language
• Just to achieve that we have something called Event
loop
• Lets look into the pictorial way where is location of JS
• Just to highlight one thing that browser instead of
just executing the JS code on client side it has many
other powers also and those powers are called as
Web API, like:
Example one
Example - 2
Example - 3
• Call back queue is formed by the call backs
• Micro task ques are formed by Promises &
mutation requestes on DOM
• Micro task queue has higher priority then call
back queue
• They both are entertained by event loop
existing between the call-stack and subsequent
queuing system
• Because of higher priority of micro tasks
queue over call back queue, it may sometime
may take really long for micro tasks queue to
finished hence it creates a "STARVATION"
situation in for call back queue
• https://www.youtube.com/watch?v=8aGhZQkoFbQ
API - Application programming Interface
• Application:
⚬ A call as a template (interface) to perform any operation is
called as API
• Programming:
⚬ API call is related to any particular operation or a
particular program
• Interface:
⚬ These calls are related to any particular endpoint with any
particular predefined template
Web development basics (Part-5)
Types of API: There are 2 major kinds of APIs now days
in market - REST API & GraphQL
• REST are bit heavy and have separate endpoints for
separate operation
• GraphQL is super lite and has only 1 endpoint called
"graphql"
• https://www.youtube.com/watch?v=PeAOEAmR0D0
Callback functions
• A function getting called up by another
function is called as call back function
Asynchronous calls
Web development basics (Part-5)
AJAX
AJAX uses XHR requests i.e. XMLHttpRequest
Promises
Web development basics (Part-5)
Different ways to handle the asynchronous calls
async-await
fetch-then

More Related Content

PPT
Web development basics (Part-6)
PPT
Web development basics (Part-7)
PPT
Web development basics (Part-3)
PPT
Web development basics (Part-2)
PPT
Web development basics (Part-4)
PPTX
I18nize Scala programs à la gettext
PPT
Web development basics (Part-1)
PDF
Fighting Ruby code smell
Web development basics (Part-6)
Web development basics (Part-7)
Web development basics (Part-3)
Web development basics (Part-2)
Web development basics (Part-4)
I18nize Scala programs à la gettext
Web development basics (Part-1)
Fighting Ruby code smell

What's hot (18)

PDF
Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya
PDF
NoSQL for great good [hanoi.rb talk]
PPTX
Day 8 - jRuby
PDF
Reflection in Pharo: Beyond Smalltak
PDF
Develop realtime web with Scala and Xitrum
PDF
Actor model : A Different Concurrency Approach
KEY
Introduction to Actor Model and Akka
PDF
Shootout! template engines on the jvm
KEY
Frozen rails 2012 - Fighting Code Smells
PPT
RubyMotion #jbday
PPTX
Proxying DBI with DBD::Gofer and App::Staticperl
PDF
Functional Programming in Clojure
KEY
Perl On The JVM (London.pm Talk 2009-04)
KEY
Java Closures
PDF
Scala.io
PPTX
JAVA 8 Parallel Stream
PPTX
Java 8 parallel stream
PPTX
Aspect j introduction for non-programmers
Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya
NoSQL for great good [hanoi.rb talk]
Day 8 - jRuby
Reflection in Pharo: Beyond Smalltak
Develop realtime web with Scala and Xitrum
Actor model : A Different Concurrency Approach
Introduction to Actor Model and Akka
Shootout! template engines on the jvm
Frozen rails 2012 - Fighting Code Smells
RubyMotion #jbday
Proxying DBI with DBD::Gofer and App::Staticperl
Functional Programming in Clojure
Perl On The JVM (London.pm Talk 2009-04)
Java Closures
Scala.io
JAVA 8 Parallel Stream
Java 8 parallel stream
Aspect j introduction for non-programmers
Ad

Similar to Web development basics (Part-5) (20)

PPTX
JS Event Loop
PDF
Plataforma distribuída de Microserviços ou, como a Olist funciona
PPTX
DEVNET-1128 Cisco Intercloud Fabric NB Api's for Business & Providers
PPTX
Micro Service Architecture
PPTX
Node.js meetup at Palo Alto Networks Tel Aviv
PDF
An introduction to Node.js
PPTX
Serverless design with Fn project
PPTX
Reactive Programming in Java 8 with Rx-Java
PDF
Web Clients for Ruby and What they should be in the future
PDF
Basic Understanding and Implement of Node.js
PPTX
Advanced Web Technology.pptx
PPTX
concept of server-side JavaScript / JS Framework: NODEJS
KEY
EventMachine
KEY
Distributed app development with nodejs and zeromq
PPTX
Oracle Cloud Native Application Development (Meetup, 20th January 2020)
PDF
No Compromise - Better, Stronger, Faster Java in the Cloud
PDF
Микросервисы со Spring Boot & Spring Cloud
PDF
Node js internal
PDF
Olist Architecture v2.0
PPTX
Evented Ruby VS Node.js
JS Event Loop
Plataforma distribuída de Microserviços ou, como a Olist funciona
DEVNET-1128 Cisco Intercloud Fabric NB Api's for Business & Providers
Micro Service Architecture
Node.js meetup at Palo Alto Networks Tel Aviv
An introduction to Node.js
Serverless design with Fn project
Reactive Programming in Java 8 with Rx-Java
Web Clients for Ruby and What they should be in the future
Basic Understanding and Implement of Node.js
Advanced Web Technology.pptx
concept of server-side JavaScript / JS Framework: NODEJS
EventMachine
Distributed app development with nodejs and zeromq
Oracle Cloud Native Application Development (Meetup, 20th January 2020)
No Compromise - Better, Stronger, Faster Java in the Cloud
Микросервисы со Spring Boot & Spring Cloud
Node js internal
Olist Architecture v2.0
Evented Ruby VS Node.js
Ad

Recently uploaded (20)

PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Introduction to Artificial Intelligence
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
medical staffing services at VALiNTRY
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Introduction to Artificial Intelligence
Understanding Forklifts - TECH EHS Solution
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Wondershare Filmora 15 Crack With Activation Key [2025
Which alternative to Crystal Reports is best for small or large businesses.pdf
Transform Your Business with a Software ERP System
Odoo Companies in India – Driving Business Transformation.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Navsoft: AI-Powered Business Solutions & Custom Software Development
Softaken Excel to vCard Converter Software.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
CHAPTER 2 - PM Management and IT Context
Design an Analysis of Algorithms II-SECS-1021-03
Odoo POS Development Services by CandidRoot Solutions
Internet Downloader Manager (IDM) Crack 6.42 Build 41
medical staffing services at VALiNTRY

Web development basics (Part-5)

  • 1. Tutorial - 6 • Revision of yesterday lecture • Create a mini project of a simple calculator • Create a mini project of todo lis • What is JSON • Event loop • Event loop examples • callback-queue • API • async calls • setTimeout • fetch • Promise
  • 2. Event loop • Any execution happening in JS is taken care of by its property of being "single threaded synchronous language" • And in order to achieve that we have Execution Context • But sometimes we have scenarios of handling the call back functions or promises where the behaviour of EC is not regular in order to maintain JS core value of single threaded + sync. language
  • 3. • Just to achieve that we have something called Event loop • Lets look into the pictorial way where is location of JS
  • 4. • Just to highlight one thing that browser instead of just executing the JS code on client side it has many other powers also and those powers are called as Web API, like:
  • 8. • Call back queue is formed by the call backs • Micro task ques are formed by Promises & mutation requestes on DOM • Micro task queue has higher priority then call back queue • They both are entertained by event loop existing between the call-stack and subsequent queuing system
  • 9. • Because of higher priority of micro tasks queue over call back queue, it may sometime may take really long for micro tasks queue to finished hence it creates a "STARVATION" situation in for call back queue • https://www.youtube.com/watch?v=8aGhZQkoFbQ
  • 10. API - Application programming Interface • Application: ⚬ A call as a template (interface) to perform any operation is called as API • Programming: ⚬ API call is related to any particular operation or a particular program • Interface: ⚬ These calls are related to any particular endpoint with any particular predefined template
  • 12. Types of API: There are 2 major kinds of APIs now days in market - REST API & GraphQL • REST are bit heavy and have separate endpoints for separate operation • GraphQL is super lite and has only 1 endpoint called "graphql"
  • 14. Callback functions • A function getting called up by another function is called as call back function
  • 17. AJAX AJAX uses XHR requests i.e. XMLHttpRequest
  • 20. Different ways to handle the asynchronous calls async-await