On Sat, May 15, 2021 at 2:19 AM stuta <patest...@gmail.com> wrote:
>
> New v8 return promise from module evaluate. My problem is that the promise 
> result is always "undefined". This code worked before the new promise return.
>
> Here's a simplified example.
>
> auto result = module->Evaluate(context).ToLocalChecked();
> Local<Promise> promise = result.As<Promise>();
> moduleResult = promise->Result().As<Object>();
>
> String::Utf8Value typeTxt(isolate, moduleResult->TypeOf(isolate));
> printf("module evaluate type is: '%s'\n", *typeTxt); // module evaluate type 
> is: 'undefined'

That's because of top-level await, and it's spec conforming:
https://github.com/tc39/proposal-top-level-await/blob/main/spec.html

I ran into the same issue last year and while I did figure out a
workaround, it was so roundabout that I didn't feel like pursuing it:
https://github.com/denoland/deno/issues/3696#issuecomment-604969312 -
you're welcome to copy the concept, of course.

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAHQurc_Savztu7XGhse8kwOTWteyAh526e9tM_h00TDvwG19uA%40mail.gmail.com.

Reply via email to