ThreadsafeFn
Thread-safe wrapper around a JS function. T is the per-call payload type. Built via Callback.threadsafe(env, name, T).
For the conceptual model and lifecycle rules, see Threadsafe functions.
T semantics
Methods
call(value, mode)
mode is napi.ThreadsafeFn(T).Mode:
.blockingwaits if the queue is full..non_blockingreturnserror.QueueFullif the queue is full.
For T = void, the call signature is try tsfn.call({}, mode).
call deep-copies slice-backed data in supported structural payloads before enqueueing. Conversion failures and exceptions thrown by the JavaScript callback are forwarded exactly once through Node.js's uncaughtException path.