[][src]Type Definition rusty_v8::HostImportModuleDynamicallyCallback

type HostImportModuleDynamicallyCallback = extern "C" fn(_: Local<'_, Context>, _: Local<'_, ScriptOrModule>, _: Local<'_, String>) -> *mut Promise;

HostImportModuleDynamicallyCallback is called when we require the embedder to load a module. This is used as part of the dynamic import syntax.

The referrer contains metadata about the script/module that calls import.

The specifier is the name of the module that should be imported.

The embedder must compile, instantiate, evaluate the Module, and obtain it's namespace object.

The Promise returned from this function is forwarded to userland JavaScript. The embedder must resolve this promise with the module namespace object. In case of an exception, the embedder must reject this promise with the exception. If the promise creation itself fails (e.g. due to stack overflow), the embedder must propagate that exception by returning an empty MaybeLocal.