0% found this document useful (0 votes)
17 views21 pages

Callbacks and Promises

Uploaded by

tempokpmet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views21 pages

Callbacks and Promises

Uploaded by

tempokpmet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

# "

" team &#


JS is
synchronous innate ( any piece of code
understandable by us will be enecutd
bu6pk±
Is

;;w


④ .

JS is
single threaded 4¥
three

^°§¥%ÉÉm
still thread
guns =

apart from PMI


webbrowseno.tnHunt
slow



Pure JS doesn't like timers
,
know
things ,

counters ,
how to connect to intend how render
,

and control
webpages etcetc_
Rambin

y①tm

÷.gy•
case 2
"
"
enka
browse
YE
,

features to

node__
Pme ②


@
⑨ frat
GW

bacbd_⑤
☒÷ ☐☐
queue -
µ#①¥☒
first can
first-season
? → event
loop

⑥0
Kentqueue__ callstah
line native code
JS will line
by enecute the .

native
anything apart from
The moment JS sees

does
then it the
following -

do to send
→ IS
just one
operation which is

signal to the centuries


,
that a runtime
feature
is accused .

→ then it sends the Fincher & augmentsdoes to the


runtime and moves
forward .
It
itw=
the moment runtime
finishes it's
fumi ,
we

don't enecute it then & 1b¥ We make it

wait inside the

euentquu-u.SN will
eneculy keep on the code &
enutqueu
will wait till the time one call stack
/ global
code is
yet
to be
cempkhd
Crimen
strings
two
*
check
if they are

anagram of
each

otuen.EE listen I
sielentl
n-
yay
Shy
→ mirin tÉ¥
HE ne_
¥
am →

Both Should have

occuuueefchnss.co#
the
swigs same

µ÷k 0¥ 10¥30
Matrintraiural mere
problem moaning

quietest ha③__
Ef quickest
this & new → Kannan
Gupta
this →
outhit
& Arnab
event
loop gave

Private → Firth
I → { 3 -
empty obs

w@==



✗ ✗
③→ this hottie
assign newly
④ 4 U bushmen fair

the
if
thi ,
Price : 'm
is not
returning an
object

srelimtaisoiaemreku1@obyutaf.s
this .
disuen.io
p.m.in

••%
am .

,
callbachs _a
what are

him
+
g cb,
asy odd
=É÷:"
Boulud done

startcaprersylaprenia.de
startuploady
sueufillfufdeed

h
feuulicn 4ile_
Promise
=

Promises enhancer (
are
readability thy enham Hu

code a
bi¥
these but special once they get returned
are
objects
immediately when we make a runtime env
fend call
funk display
l
( data )
Effi
data÷ asy
.

law
s

w¥fd
"

C
fetch www.abc.cai)
"
=
hltp.tl ;

plaited
promise
. then ( display ) ;
Guizot
fd variable will be
story
a
poamohyt-_
So does & an oilseed
promis
2
thugs ,
one inside
gs
SS i. eountiw .

'

outer
fund
will to
1) It the call the
give
env .

2) it
gives placeholdera to the variable in the

form promise objet


Inside the placeholder promise object we have
fewproperties
① value :
initially
when the
fetch call is

not
completed ,
value well be
undefined but

as soon
fetch is
completed the result
of
stored
the
fund call will be in his

value
property
of turf
② on
fulfillment this is : an
array ;
Now as soon

as
fetch is completed & value property
gets me

enact
response ,
we one
by one start

enecuty
the
functions present in this
array
with value
property as
argument
who
fills this
array
?? So this
forms object has
=
pass inside
" "

then
fine also wheaten
funen
"
a we
,

then gets added to a


full blunt
witop
>
-

a / Flack
0
2
euutq=_
0
2
task this halls all we call back
]→ enmity
micro

9¥ of promise
micro taste
gum
has
hyhm¥f

You might also like