Trait script::dom::bindings::callback::CallbackContainer

source ·
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§

source

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

Create a new CallbackContainer object for the given JSObject.

source

fn callback_holder(&self) -> &CallbackObject

Returns the underlying CallbackObject.

Provided Methods§

source

fn callback(&self) -> *mut JSObject

Returns the underlying JSObject.

source

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.

Implementors§