Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(runtime): "Worker::execute_script" returns value #17092

Merged
merged 5 commits into from
Dec 18, 2022

Conversation

gofenix
Copy link
Contributor

@gofenix gofenix commented Dec 17, 2022

This PR is for #16065

Now, the execute_script:

  /// See [JsRuntime::execute_script](deno_core::JsRuntime::execute_script)
  pub fn execute_script(
    &mut self,
    script_name: &str,
    source_code: &str,
  ) -> Result<(), AnyError> {
    self.js_runtime.execute_script(script_name, source_code)?;
    Ok(())
  }

I think we can get the value from execute_script function.

  pub fn execute_script(
    &mut self,
    script_name: &str,
    source_code: &str,
  ) -> Result<v8::Global<v8::Value>, AnyError> {
    self.js_runtime.execute_script(script_name, source_code)
  }

@CLAassistant
Copy link

CLAassistant commented Dec 17, 2022

CLA assistant check
All committers have signed the CLA.

@gofenix gofenix changed the title feat: add execute_script_with_return function feat(runtime): add execute_script_with_return function Dec 17, 2022
runtime/worker.rs Outdated Show resolved Hide resolved
runtime/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @zhenfeng-zhu

@bartlomieju bartlomieju changed the title feat(runtime): add execute_script_with_return function refactor(runtime): "Worker::execute_script" returns value Dec 18, 2022
@bartlomieju bartlomieju merged commit 97f280e into denoland:main Dec 18, 2022
bartlomieju pushed a commit that referenced this pull request Jan 5, 2023
This commit changes "Worker::execute_script" to return a global
handle to "v8::Value".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants