Struct deno_runtime::web_worker::WebWorker
source · pub struct WebWorker {
pub js_runtime: JsRuntime,
pub name: String,
pub worker_type: WebWorkerType,
pub main_module: ModuleSpecifier,
/* private fields */
}
Expand description
This struct is an implementation of Worker
Web API
Each WebWorker
is either a child of MainWorker
or other
WebWorker
.
Fields§
§js_runtime: JsRuntime
§name: String
§worker_type: WebWorkerType
§main_module: ModuleSpecifier
Implementations§
source§impl WebWorker
impl WebWorker
pub fn bootstrap_from_options( name: String, permissions: PermissionsContainer, main_module: ModuleSpecifier, worker_id: WorkerId, options: WebWorkerOptions ) -> (Self, SendableWebWorkerHandle)
pub fn from_options( name: String, permissions: PermissionsContainer, main_module: ModuleSpecifier, worker_id: WorkerId, options: WebWorkerOptions ) -> (Self, SendableWebWorkerHandle)
pub fn bootstrap(&mut self, options: &BootstrapOptions)
sourcepub fn execute_script(
&mut self,
name: &'static str,
source_code: ModuleCode
) -> Result<(), AnyError>
pub fn execute_script( &mut self, name: &'static str, source_code: ModuleCode ) -> Result<(), AnyError>
sourcepub async fn preload_main_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<ModuleId, AnyError>
pub async fn preload_main_module( &mut self, module_specifier: &ModuleSpecifier ) -> Result<ModuleId, AnyError>
Loads and instantiates specified JavaScript module as “main” module.
sourcepub async fn preload_side_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<ModuleId, AnyError>
pub async fn preload_side_module( &mut self, module_specifier: &ModuleSpecifier ) -> Result<ModuleId, AnyError>
Loads and instantiates specified JavaScript module as “side” module.
sourcepub async fn execute_side_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<(), AnyError>
pub async fn execute_side_module( &mut self, module_specifier: &ModuleSpecifier ) -> Result<(), AnyError>
Loads, instantiates and executes specified JavaScript module.
This method assumes that worker can’t be terminated when executing side module code.
sourcepub async fn execute_main_module(
&mut self,
id: ModuleId
) -> Result<(), AnyError>
pub async fn execute_main_module( &mut self, id: ModuleId ) -> Result<(), AnyError>
Loads, instantiates and executes specified JavaScript module.
This module will have “import.meta.main” equal to true.
pub async fn run_event_loop( &mut self, wait_for_inspector: bool ) -> Result<(), AnyError>
Auto Trait Implementations§
impl !RefUnwindSafe for WebWorker
impl !Send for WebWorker
impl !Sync for WebWorker
impl Unpin for WebWorker
impl !UnwindSafe for WebWorker
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more