| 39 | } |
| 40 | |
| 41 | TSFNWrap::TSFNWrap(const CallbackInfo& info) : ObjectWrap<TSFNWrap>(info) { |
| 42 | Napi::Env env = info.Env(); |
| 43 | |
| 44 | Reference<Napi::Value>* _ctx = new Reference<Napi::Value>; |
| 45 | *_ctx = Persistent(info[0]); |
| 46 | |
| 47 | _tsfn = ThreadSafeFunction::New( |
| 48 | info.Env(), |
| 49 | Function::New(env, [](const CallbackInfo& /*info*/) {}), |
| 50 | Object::New(env), |
| 51 | "Test", |
| 52 | 1, |
| 53 | 1, |
| 54 | _ctx, |
| 55 | [this](Napi::Env env, Reference<Napi::Value>* ctx) { |
| 56 | _deferred->Resolve(env.Undefined()); |
| 57 | ctx->Reset(); |
| 58 | delete ctx; |
| 59 | }); |
| 60 | } |
| 61 | struct SimpleTestContext { |
| 62 | SimpleTestContext(int val) : _val(val) {} |
| 63 | int _val = -1; |
nothing calls this directly
no test coverage detected