Function quickjs_runtime::jsutils::promises::new_resolving_promise

source ยท
pub fn new_resolving_promise<P, R, M>(
    realm: &QuickJsRealmAdapter,
    producer: P,
    mapper: M,
) -> Result<QuickJsValueAdapter, JsError>
where R: Send + 'static, P: FnOnce() -> Result<R, JsError> + Send + 'static, M: FnOnce(&QuickJsRealmAdapter, R) -> Result<QuickJsValueAdapter, JsError> + Send + 'static,
Expand description

create a new promise with a producer and a mapper the producer will run in a helper thread(in the tokio thread pool) and thus get a result asynchronously the resulting value will then be mapped to a JSValueRef by the mapper in the EventQueue thread the promise which was returned is then resolved with the value which is returned by the mapper