diff options
| author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-10-07 22:30:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-07 22:30:06 +0200 |
| commit | d8879feb8c832dbb38649551b1cb0730874f7be6 (patch) | |
| tree | ece7adc6d3611c87f6c2f13732b29ac4314a80ef /core/README.md | |
| parent | 8bd7c936f9a9a63334e5f512d6b6c1f8b47a42b8 (diff) | |
refactor(core): JsRuntime is not a Future (#7855)
This commit rewrites deno_core::JsRuntime to not implement Future
trait.
Instead there are two separate methods:
- JsRuntime::poll_event_loop() - does single tick of event loop
- JsRuntime::run_event_loop() - runs event loop to completion
Diffstat (limited to 'core/README.md')
| -rw-r--r-- | core/README.md | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/README.md b/core/README.md index f6b429bb8..2438ecede 100644 --- a/core/README.md +++ b/core/README.md @@ -9,9 +9,12 @@ bindings. This Rust crate contains the essential V8 bindings for Deno's command-line interface (Deno CLI). The main abstraction here is the JsRuntime which provides -a way to execute JavaScript. The JsRuntime is modeled as a -`Future<Item=(), Error=JsError>` which completes once all of its ops have -completed. +a way to execute JavaScript. + +The JsRuntime implements an event loop abstraction for the executed code that +keeps track of all pending tasks (async ops, dynamic module loads). It is user's +responsibility to drive that loop by using `JsRuntime::run_event_loop` method - +it must be executed in the context of Rust's future executor (eg. tokio, smol). In order to bind Rust functions into JavaScript, use the `Deno.core.dispatch()` function to trigger the "dispatch" callback in Rust. The user is responsible for |
