bun-types
Advanced tools
Comparing version 1.1.43-canary.20250108T140520 to 1.1.43-canary.20250109T140709
@@ -300,2 +300,16 @@ Use the built-in `bun:ffi` module to efficiently call native libraries from JavaScript. It works with languages that support the C ABI (Zig, Rust, C/C++, C#, Nim, Kotlin, etc). | ||
### Experimental thread-safe callbacks | ||
`JSCallback` has experimental support for thread-safe callbacks. This will be needed if you pass a callback function into a different thread from it's instantiation context. You can enable it with the optional `threadsafe` option flag. | ||
```ts | ||
const searchIterator = new JSCallback( | ||
(ptr, length) => /hello/.test(new CString(ptr, length)), | ||
{ | ||
returns: "bool", | ||
args: ["ptr", "usize"], | ||
threadsafe: true, // Optional. Defaults to `false` | ||
}, | ||
); | ||
``` | ||
Be aware that there are still cases where this does not 100% work. | ||
{% callout %} | ||
@@ -302,0 +316,0 @@ |
{ | ||
"version": "1.1.43-canary.20250108T140520", | ||
"version": "1.1.43-canary.20250109T140709", | ||
"name": "bun-types", | ||
@@ -4,0 +4,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
1293370
13407