Wrap app.close, update uWS

This commit is contained in:
Alex Hultman
2022-12-28 14:45:54 +01:00
parent 02115158d9
commit f569b9d791
2 changed files with 10 additions and 1 deletions

View File

@@ -305,6 +305,14 @@ void uWS_App_get(F f, const FunctionCallbackInfo<Value> &args) {
args.GetReturnValue().Set(args.Holder());
}
template <typename APP>
void uWS_App_close(const FunctionCallbackInfo<Value> &args) {
APP *app = (APP *) args.Holder()->GetAlignedPointerFromInternalField(0);
app->close();
args.GetReturnValue().Set(args.Holder());
}
template <typename APP>
void uWS_App_listen(const FunctionCallbackInfo<Value> &args) {
APP *app = (APP *) args.Holder()->GetAlignedPointerFromInternalField(0);
@@ -628,6 +636,7 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
}, args.Data()));
appTemplate->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "listen", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_App_listen<APP>, args.Data()));
appTemplate->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "close", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_App_close<APP>, args.Data()));
if constexpr (!std::is_same<APP, uWS::H3App>::value) {