| 46 | #include "objects/statement-iterator.cpp" |
| 47 | |
| 48 | Napi::Object InitAll(Napi::Env env, Napi::Object exports) { |
| 49 | Napi::HandleScope scope(env); |
| 50 | Addon::ConfigureURI(); |
| 51 | |
| 52 | // Initialize addon instance. The addon is bound to each native-backed class |
| 53 | // as callback data (rather than per-environment instance data) so that |
| 54 | // multiple copies of the addon can be loaded into a single environment. |
| 55 | Addon* addon = new Addon(env); |
| 56 | env.AddCleanupHook(Addon::Cleanup, addon); |
| 57 | |
| 58 | // Create and export native-backed classes and functions. |
| 59 | exports.Set("Database", Database::Init(env, addon)); |
| 60 | exports.Set("Statement", Statement::Init(env, addon)); |
| 61 | exports.Set("StatementIterator", StatementIterator::Init(env, addon)); |
| 62 | exports.Set("Backup", Backup::Init(env, addon)); |
| 63 | exports.Set("initialize", Napi::Function::New(env, Addon::JS_initialize, "initialize", addon)); |
| 64 | |
| 65 | // Store addon instance data. |
| 66 | addon->Statement = Napi::Persistent(exports.Get("Statement").As<Napi::Function>()); |
| 67 | addon->StatementIterator = Napi::Persistent(exports.Get("StatementIterator").As<Napi::Function>()); |
| 68 | addon->Backup = Napi::Persistent(exports.Get("Backup").As<Napi::Function>()); |
| 69 | |
| 70 | return exports; |
| 71 | } |
| 72 | |
| 73 | NODE_API_MODULE(better_sqlite3, InitAll) |
nothing calls this directly
no outgoing calls
no test coverage detected