pub trait CallbackContainer {
    // Required methods
    unsafe fn new(cx: JSContext, callback: *mut JSObject) -> Rc<Self>;
    fn callback_holder(&self) -> &CallbackObject;

    // Provided methods
    fn callback(&self) -> *mut JSObject { ... }
    fn incumbent(&self) -> Option<&GlobalScope> { ... }
Expand description

A trait to be implemented by concrete IDL callback function and callback interface types.

Required Methods§


unsafe fn new(cx: JSContext, callback: *mut JSObject) -> Rc<Self>

Create a new CallbackContainer object for the given JSObject.


fn callback_holder(&self) -> &CallbackObject

Returns the underlying CallbackObject.

Provided Methods§


fn callback(&self) -> *mut JSObject

Returns the underlying JSObject.


fn incumbent(&self) -> Option<&GlobalScope>

Returns the “callback context”, that is, the global to use as incumbent global when calling the callback.

Object Safety§

This trait is not object safe.