2020-07-23 10:27:26 -04:00
|
|
|
# Runtime JavaScript Code
|
2020-07-19 13:49:44 -04:00
|
|
|
|
|
|
|
This directory contains Deno runtime code written in plain JavaScript.
|
|
|
|
|
|
|
|
Each file is a plain, old **script**, not ES modules. The reason is that
|
|
|
|
snapshotting ES modules is much harder, especially if one needs to manipulate
|
|
|
|
global scope (like in case of Deno).
|
|
|
|
|
|
|
|
Each file is prefixed with a number, telling in which order scripts should be
|
|
|
|
loaded into V8 isolate. This is temporary solution and we're striving not to
|
|
|
|
require specific order (though it's not 100% obvious if that's feasible).
|
2020-07-22 13:30:59 -04:00
|
|
|
|
|
|
|
## Deno Web APIs
|
|
|
|
|
|
|
|
This directory facilities Web APIs that are available in Deno.
|
|
|
|
|
|
|
|
Please note, that some implementations might not be completely aligned with
|
|
|
|
specification.
|
|
|
|
|
|
|
|
Some Web APIs are using ops under the hood, eg. `console`, `performance`.
|
|
|
|
|
|
|
|
## Implemented Web APIs
|
|
|
|
|
|
|
|
- [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob): for
|
2020-10-03 16:19:11 -04:00
|
|
|
representing opaque binary data.
|
2020-07-22 13:30:59 -04:00
|
|
|
- [Console](https://developer.mozilla.org/en-US/docs/Web/API/Console): for
|
2020-10-03 16:19:11 -04:00
|
|
|
logging purposes.
|
2020-07-22 13:30:59 -04:00
|
|
|
- [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent),
|
|
|
|
[EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget)
|
|
|
|
and
|
|
|
|
[EventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventListener):
|
2020-10-03 16:19:11 -04:00
|
|
|
to work with DOM events.
|
2020-07-22 13:30:59 -04:00
|
|
|
- **Implementation notes:** There is no DOM hierarchy in Deno, so there is no
|
|
|
|
tree for Events to bubble/capture through.
|
|
|
|
- [fetch](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch),
|
|
|
|
[Request](https://developer.mozilla.org/en-US/docs/Web/API/Request),
|
|
|
|
[Response](https://developer.mozilla.org/en-US/docs/Web/API/Response),
|
|
|
|
[Body](https://developer.mozilla.org/en-US/docs/Web/API/Body) and
|
|
|
|
[Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers): modern
|
2020-10-03 16:19:11 -04:00
|
|
|
Promise-based HTTP Request API.
|
2021-01-07 13:06:08 -05:00
|
|
|
- [location](https://developer.mozilla.org/en-US/docs/Web/API/Window/location)
|
|
|
|
and [Location](https://developer.mozilla.org/en-US/docs/Web/API/Location).
|
2020-07-22 13:30:59 -04:00
|
|
|
- [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData): access
|
2020-10-03 16:19:11 -04:00
|
|
|
to a `multipart/form-data` serialization.
|
2020-07-22 13:30:59 -04:00
|
|
|
- [Performance](https://developer.mozilla.org/en-US/docs/Web/API/Performance):
|
2020-10-03 16:19:11 -04:00
|
|
|
retrieving current time with a high precision.
|
2020-07-22 13:30:59 -04:00
|
|
|
- [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout),
|
|
|
|
[setInterval](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval),
|
|
|
|
[clearTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/clearTimeout):
|
|
|
|
scheduling callbacks in future and
|
2020-10-03 16:19:11 -04:00
|
|
|
[clearInterval](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/clearInterval).
|
2020-07-22 13:30:59 -04:00
|
|
|
- [Stream](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) for
|
2020-10-03 16:19:11 -04:00
|
|
|
creating, composing, and consuming streams of data.
|
2020-07-22 13:30:59 -04:00
|
|
|
- [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) and
|
|
|
|
[URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams):
|
2020-10-03 16:19:11 -04:00
|
|
|
to construct and parse URLSs.
|
2020-07-22 13:30:59 -04:00
|
|
|
- [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker): executing
|
2020-10-03 16:19:11 -04:00
|
|
|
additional code in a separate thread.
|
2020-07-22 13:30:59 -04:00
|
|
|
- **Implementation notes:** Blob URLs are not supported, object ownership
|
|
|
|
cannot be transferred, posted data is serialized to JSON instead of
|
|
|
|
[structured cloning](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm).
|