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§
sourceunsafe fn new(cx: JSContext, callback: *mut JSObject) -> Rc<Self>
unsafe fn new(cx: JSContext, callback: *mut JSObject) -> Rc<Self>
Create a new CallbackContainer object for the given JSObject
.
sourcefn callback_holder(&self) -> &CallbackObject
fn callback_holder(&self) -> &CallbackObject
Returns the underlying CallbackObject
.
Provided Methods§
sourcefn incumbent(&self) -> Option<&GlobalScope>
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.