Skip to main content

WorkerMethods

pub trait WorkerMethods<D: DomTypes> {
    // Required methods
    fn Terminate(&self);
    fn PostMessage(
        &self,
        cx: &mut JSContext,
        message: HandleValue<'_>,
        transfer: CustomAutoRooterGuard<'_, Vec<*mut JSObject>>,
    ) -> Fallible<()>;
    fn PostMessage_(
        &self,
        cx: &mut JSContext,
        message: HandleValue<'_>,
        options: RootedTraceableBox<StructuredSerializeOptions>,
    ) -> Fallible<()>;
    fn GetOnmessage(
        &self,
        cx: &mut JSContext,
    ) -> Option<Rc<EventHandlerNonNull<D>>>;
    fn SetOnmessage(
        &self,
        cx: &mut JSContext,
        value: Option<Rc<EventHandlerNonNull<D>>>,
    );
    fn GetOnmessageerror(
        &self,
        cx: &mut JSContext,
    ) -> Option<Rc<EventHandlerNonNull<D>>>;
    fn SetOnmessageerror(
        &self,
        cx: &mut JSContext,
        value: Option<Rc<EventHandlerNonNull<D>>>,
    );
    fn GetOnerror(
        &self,
        cx: &mut JSContext,
    ) -> Option<Rc<EventHandlerNonNull<D>>>;
    fn SetOnerror(
        &self,
        cx: &mut JSContext,
        value: Option<Rc<EventHandlerNonNull<D>>>,
    );
    fn Constructor(
        cx: &mut JSContext,
        global: &D::GlobalScope,
        proto: Option<HandleObject<'_>>,
        scriptURL: TrustedScriptURLOrUSVString<D>,
        options: &WorkerOptions,
    ) -> Fallible<DomRoot<D::Worker>>;
}

Required Methods§

Source

fn Terminate(&self)

Source

fn PostMessage( &self, cx: &mut JSContext, message: HandleValue<'_>, transfer: CustomAutoRooterGuard<'_, Vec<*mut JSObject>>, ) -> Fallible<()>

Source

fn PostMessage_( &self, cx: &mut JSContext, message: HandleValue<'_>, options: RootedTraceableBox<StructuredSerializeOptions>, ) -> Fallible<()>

Source

fn GetOnmessage(&self, cx: &mut JSContext) -> Option<Rc<EventHandlerNonNull<D>>>

Source

fn SetOnmessage( &self, cx: &mut JSContext, value: Option<Rc<EventHandlerNonNull<D>>>, )

Source

fn GetOnmessageerror( &self, cx: &mut JSContext, ) -> Option<Rc<EventHandlerNonNull<D>>>

Source

fn SetOnmessageerror( &self, cx: &mut JSContext, value: Option<Rc<EventHandlerNonNull<D>>>, )

Source

fn GetOnerror(&self, cx: &mut JSContext) -> Option<Rc<EventHandlerNonNull<D>>>

Source

fn SetOnerror( &self, cx: &mut JSContext, value: Option<Rc<EventHandlerNonNull<D>>>, )

Source

fn Constructor( cx: &mut JSContext, global: &D::GlobalScope, proto: Option<HandleObject<'_>>, scriptURL: TrustedScriptURLOrUSVString<D>, options: &WorkerOptions, ) -> Fallible<DomRoot<D::Worker>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§