construct in js_sys::Reflect - Rust (original) (raw)

Skip to main content

js_sys0.3.91

In js_sys::Reflect

js_sys::Reflect

Function construct

Source

pub fn construct<T>(
    target: &Function<T>,
    arguments_list: &Array,
) -> Result<JsValue, JsValue>

where
    T: JsFunction,
    Function<T>: ErasableGenericBorrow<Function<fn() -> JsValue>>,

Expand description

The static Reflect.construct() method acts like the new operator, but as a function. It is equivalent to calling new target(...args). It gives also the added option to specify a different prototype.

MDN documentation