Type Alias script::dom::bindings::import::module::jsapi::ModuleDynamicImportHook

source ·
pub type ModuleDynamicImportHook = Option<unsafe extern "C" fn(_: *mut JSContext, _: Handle<Value>, _: Handle<*mut JSObject>, _: Handle<*mut JSObject>) -> bool>;
Expand description

The HostImportModuleDynamically hook.

See https://tc39.es/ecma262/#sec-hostimportmoduledynamically

Used to implement dynamic module import. Called when evaluating import() expressions.

This starts an asynchronous operation. Some time after this hook is called the embedding must call JS::FinishDynamicModuleImport() passing the |referencingPrivate|, |moduleRequest| and |promise| arguments from the call. This must happen for both success and failure cases.

In the meantime the embedding can take whatever steps it needs to make the module available. If successful, after calling FinishDynamicModuleImport() the module should be returned by the resolve hook when passed |referencingPrivate| and |moduleRequest|.

Aliased Type§

enum ModuleDynamicImportHook {
    None,
    Some(unsafe extern "C" fn(_: *mut JSContext, _: Handle<Value>, _: Handle<*mut JSObject>, _: Handle<*mut JSObject>) -> bool),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(_: *mut JSContext, _: Handle<Value>, _: Handle<*mut JSObject>, _: Handle<*mut JSObject>) -> bool)

Some value of type T.