Cannot CallJS from listen

This commit is contained in:
Alex Hultman 2020-03-15 13:58:51 +01:00
parent cd23eeb1a0
commit 4be2f2bfc2
1 changed files with 2 additions and 1 deletions

View File

@ -236,7 +236,8 @@ void uWS_App_listen(const FunctionCallbackInfo<Value> &args) {
auto cb = [&args, isolate](auto *token) {
/* Return a false boolean if listen failed */
Local<Value> argv[] = {token ? Local<Value>::Cast(External::New(isolate, token)) : Local<Value>::Cast(Boolean::New(isolate, false))};
CallJS(isolate, Local<Function>::Cast(args[args.Length() - 1]), 1, argv);
/* Immediate call cannot be CallJS */
Local<Function>::Cast(args[args.Length() - 1])->Call(isolate->GetCurrentContext(), isolate->GetCurrentContext()->Global(), 1, argv);
};
/* Host is first, if present */