(no title)
OscarDC | 2 years ago
Those API could be thought as from the "environment" in which JavaScript run. For example we often call web-only APIs "DOM API": `fetch`, `xmlHttpRequest` and so on.
Node.js also has its own environment. For example both `setTimeout` and `setInterval`, though present in both web and node.js, are implemented differently by browsers and node.js (it's just that node.js decided to go with roughly the same API - see below for code examples for both).
Taking requests as examples there are both declared in blink, the rendering engine and not v8 again because they aren't JS:
- fetch (https://source.chromium.org/chromium/chromium/src/+/main:thi...)
- XMLHttpRequest (https://source.chromium.org/chromium/chromium/src/+/main:thi...)
For the fun of looking even more at some code of reputable projects: for setTimeout / setInterval, I would guess they are declared here in blink: https://source.chromium.org/chromium/chromium/src/+/main:thi...
And maybe here for Node.js: https://github.com/nodejs/node/blob/8a41d9b636be86350cd32847...
To note that "filesystem" API also exist in web world: https://fs.spec.whatwg.org
Again, this API is completely different than in Node.JS
DanielHB|2 years ago