diff options
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r-- | runtime/worker.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs index a995861c5..a24a22c96 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -21,6 +21,7 @@ use deno_core::FsModuleLoader; use deno_core::GetErrorClassFn; use deno_core::JsRuntime; use deno_core::LocalInspectorSession; +use deno_core::ModuleCode; use deno_core::ModuleId; use deno_core::ModuleLoader; use deno_core::ModuleSpecifier; @@ -364,10 +365,10 @@ impl MainWorker { } /// See [JsRuntime::execute_script](deno_core::JsRuntime::execute_script) - pub fn execute_script( + pub fn execute_script<S: Into<ModuleCode>>( &mut self, - script_name: &str, - source_code: &str, + script_name: &'static str, + source_code: S, ) -> Result<v8::Global<v8::Value>, AnyError> { self.js_runtime.execute_script(script_name, source_code) } @@ -502,7 +503,7 @@ impl MainWorker { /// Does not poll event loop, and thus not await any of the "load" event handlers. pub fn dispatch_load_event( &mut self, - script_name: &str, + script_name: &'static str, ) -> Result<(), AnyError> { self.execute_script( script_name, @@ -519,7 +520,7 @@ impl MainWorker { /// Does not poll event loop, and thus not await any of the "unload" event handlers. pub fn dispatch_unload_event( &mut self, - script_name: &str, + script_name: &'static str, ) -> Result<(), AnyError> { self.execute_script( script_name, @@ -536,7 +537,7 @@ impl MainWorker { /// running. pub fn dispatch_beforeunload_event( &mut self, - script_name: &str, + script_name: &'static str, ) -> Result<bool, AnyError> { let value = self.js_runtime.execute_script( script_name, |