Add _cfg
This commit is contained in:
parent
6d38c7ecf2
commit
1cc6d0dd8c
@ -56,8 +56,24 @@ void NeuterArrayBuffer(Local<ArrayBuffer> ab) {
|
||||
#include "HttpRequestWrapper.h"
|
||||
#include "AppWrapper.h"
|
||||
|
||||
#include <numeric>
|
||||
#include <functional>
|
||||
|
||||
/* Todo: Apps should be freed once the GC says so BUT ALWAYS before freeing the loop */
|
||||
|
||||
/* Pass various undocumented configs */
|
||||
void uWS_cfg(const FunctionCallbackInfo<Value> &args) {
|
||||
NativeString key(args.GetIsolate(), args[0]);
|
||||
if (key.isInvalid(args)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int keyCode = std::accumulate(key.getString().begin(), key.getString().end(), 1, std::plus<int>());
|
||||
if (keyCode == 656) {
|
||||
uWS::Loop::get()->setSilent(true);
|
||||
}
|
||||
}
|
||||
|
||||
/* This has to be called in beforeExit, but exit also seems okay */
|
||||
void uWS_free(const FunctionCallbackInfo<Value> &args) {
|
||||
/* Holder is exports */
|
||||
@ -157,7 +173,7 @@ void uWS_setInteger(const FunctionCallbackInfo<Value> &args) {
|
||||
}
|
||||
|
||||
uint32_t value = Local<Integer>::Cast(args[1])->Value();
|
||||
|
||||
|
||||
NativeString collection(args.GetIsolate(), args[2]);
|
||||
if (collection.isInvalid(args)) {
|
||||
return;
|
||||
@ -333,6 +349,8 @@ void Main(Local<Object> exports) {
|
||||
exports->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "deleteStringCollection", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_deleteStringCollection)->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()).ToChecked();
|
||||
exports->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "deleteIntegerCollection", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_deleteIntegerCollection)->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()).ToChecked();
|
||||
|
||||
exports->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "_cfg", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_cfg)->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()).ToChecked();
|
||||
|
||||
/* Expose some µSockets functions directly under uWS namespace */
|
||||
exports->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "us_listen_socket_close", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_us_listen_socket_close)->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()).ToChecked();
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 5507dd55608583b83931d127729e116648d48f4c
|
||||
Subproject commit 270308f10446c55b4a8c3c6ada62f81e77e1917c
|
Loading…
Reference in New Issue
Block a user