Skip to content

Add example/api to use ThreadSafeFunction with optional callback param #544

Description

@legendecas

Since nodejs/node#27791 has been landed, there might be some use cases on node-addon-api to use Napi::ThreadSafeFunction with optional callback parameter.

Approaches might be adding an example of how to use existing Napi::ThreadSafeFunction::New like:

Function callback;
auto tsfn = ThreadSafeFunction::New(env, callback, resource_name, 1, 1);

(is there a more intuitive one?)

Or add a new API which make the callback omitted:

auto tsfn = ThreadSafeFunction::New(env, resource_name, 1, 1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions