in src/database.cc [354:394]
Napi::Value Database::Configure(const Napi::CallbackInfo& info) {
Napi::Env env = this->Env();
Database* db = this;
REQUIRE_ARGUMENTS(2);
if (info[0].StrictEquals( Napi::String::New(env, "trace"))) {
Napi::Function handle;
Baton* baton = new Baton(db, handle);
db->Schedule(RegisterTraceCallback, baton);
}
else if (info[0].StrictEquals( Napi::String::New(env, "profile"))) {
Napi::Function handle;
Baton* baton = new Baton(db, handle);
db->Schedule(RegisterProfileCallback, baton);
}
else if (info[0].StrictEquals( Napi::String::New(env, "busyTimeout"))) {
if (!info[1].IsNumber()) {
Napi::TypeError::New(env, "Value must be an integer").ThrowAsJavaScriptException();
return env.Null();
}
Napi::Function handle;
Baton* baton = new Baton(db, handle);
baton->status = info[1].As<Napi::Number>().Int32Value();
db->Schedule(SetBusyTimeout, baton);
}
else {
Napi::TypeError::New(env, (StringConcat(
#if V8_MAJOR_VERSION > 6
info.GetIsolate(),
#endif
info[0].As<Napi::String>(),
Napi::String::New(env, " is not a valid configuration option")
)).Utf8Value().c_str()).ThrowAsJavaScriptException();
return env.Null();
}
db->Process();
return info.This();
}