Fix app.listen(host, ...
This commit is contained in:
parent
2b18558653
commit
319eea90bd
1 changed files with 2 additions and 2 deletions
|
@ -189,14 +189,14 @@ void uWS_App_listen(const FunctionCallbackInfo<Value> &args) {
|
||||||
auto cb = [&args](auto *token) {
|
auto cb = [&args](auto *token) {
|
||||||
/* Return a false boolean if listen failed */
|
/* 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))};
|
Local<Value> argv[] = {token ? Local<Value>::Cast(External::New(isolate, token)) : Local<Value>::Cast(Boolean::New(isolate, false))};
|
||||||
Local<Function>::Cast(args[1])->Call(isolate->GetCurrentContext()->Global(), 1, argv);
|
Local<Function>::Cast(args[args.Length() - 1])->Call(isolate->GetCurrentContext()->Global(), 1, argv);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (args.Length() == 2) {
|
if (args.Length() == 2) {
|
||||||
/* Port, callback */
|
/* Port, callback */
|
||||||
int port = args[0]->Uint32Value(args.GetIsolate()->GetCurrentContext()).ToChecked();
|
int port = args[0]->Uint32Value(args.GetIsolate()->GetCurrentContext()).ToChecked();
|
||||||
app->listen(port, std::move(cb));
|
app->listen(port, std::move(cb));
|
||||||
} else {
|
} else if (args.Length() == 3) {
|
||||||
/* Host, port, callback */
|
/* Host, port, callback */
|
||||||
NativeString host(isolate, args[0]);
|
NativeString host(isolate, args[0]);
|
||||||
int port = args[1]->Uint32Value(args.GetIsolate()->GetCurrentContext()).ToChecked();
|
int port = args[1]->Uint32Value(args.GetIsolate()->GetCurrentContext()).ToChecked();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue