Skip to content

Commit 90fda4b

Browse files
Update 16-Async-EventLoops.md
1 parent ff2c87f commit 90fda4b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Notes/16-Async-EventLoops.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,20 @@
44
55
**Browser has JS Engine which has Call Stack which has Global exec context, local exec context etc**
66
- But browser has many other *superpowers* - Local storage space, Timer, place to enter URL, Bluetooth access, Geolocation access and so on
7-
- Now JS needs some way to connect the callstack with all these superpowers.
7+
- Now JS needs some way to connect the callstack with all these superpowers. This is done using **Web APIs**
8+
9+
### WebAPIs
10+
None of the below are part of Javascript! These are extra superpowers that browser has. Browser gives access to JS callstack to use these powers.
11+
> setTimeout(), DOM APIs, fetch(), localstorage, console (yes, even console.log is not JS!!), location and so many more..
12+
13+
- setTimeout() : Timer function
14+
- DOM APIs : eg.Document.xxxx ; Used to access HTML <html><script><body>..... DOM tree. (Document Object Manipulation)
15+
- fetch() : Used to make connection with external servers eg. Netflix servers etc.
16+
17+
We get all these inside call stack through *global object* ie. **window**
18+
- Use window keyword like : window.setTimeout(), window.localstorage, window.console.log() to log something inside console.
19+
- As window is global obj, and all the above functions are present in global object, we don't explicity write *window* but it is implied
20+
21+
22+
823

0 commit comments

Comments
 (0)