JSCallback

Bun

Symbol

JSCallback

class JSCallback

Pass a JavaScript function to FFI (Foreign Function Interface)

  • readonly ptr: null | Pointer

    The pointer to the C function

    Becomes null once JSCallback.prototype.close is called

  • readonly threadsafe: boolean

    Can the callback be called from a different thread?

  • close(): void

    Free the memory allocated for the callback

    If called multiple times, does nothing after the first call.