#include #include #include #include #include "codec/NativeCodec.h" using namespace std; tc::WorkerPool* tc::codec_workers = nullptr; NAN_METHOD(finalize) { auto pool = tc::codec_workers; if(!pool) return; tc::codec_workers = nullptr; pool->finalize(); delete pool; } NAN_MODULE_INIT(init) { tc::codec_workers = new tc::WorkerPool(); tc::codec_workers->initialize(); Nan::Set(target, Nan::New("new_instance").ToLocalChecked(), Nan::GetFunction(Nan::New(tc::NativeCodec::NewInstance)).ToLocalChecked()); tc::NativeCodec::Init(target); tc::NativeCodec::CodecType::Init(target); } NODE_MODULE(MODULE_NAME, init)