Skip to content

Get JsRuntime execution output #12630

@gufoe

Description

@gufoe

Hello, I'd like to reopen the issue #11105 of getting something useful from the script evaluation of deno_code.

So, I'd like to use deno to interpret js at runtime and get the result, for instance:

let res = runtime.execute_script("<main>", "123");
assert!(res.unwrap() == serde_json::Value::from(123))

But I cannot understand how to transform a Global into something useful.

Is there any way to achieve this?
I know there has been discussion in #11129 about the return value not always being deserializable.
Couldn't a enum be returned?
Something like this:

enum EvalResult {
  Deserializable(?)
  Other(Global<Value>)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions