@quilted/events
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -20,4 +20,4 @@ /** | ||
export declare class NestedAbortController extends AbortController { | ||
constructor(...parents: AbortSignal[]); | ||
constructor(...parents: Pick<AbortSignal, 'aborted' | 'reason' | 'addEventListener'>[]); | ||
} | ||
//# sourceMappingURL=NestedAbortController.d.ts.map |
# @quilted/events | ||
## 2.1.1 | ||
### Patch Changes | ||
- [#818](https://github.com/lemonmade/quilt/pull/818) [`8669216`](https://github.com/lemonmade/quilt/commit/8669216a28c6d8b5b62d4f297ece8f44b8f9f3ae) Thanks [@lemonmade](https://github.com/lemonmade)! - Changed Preact thread utilities to be class-based instead of being a collection of utility functions. | ||
Previously, you used `createThreadSignal()` to serialize a Preact signal to pass over a thread, and `acceptThreadSignal()` to turn it into a "live" signal. With the new API, you will do the same steps, but with `ThreadSignal.serialize()` and `new ThreadSignal()`: | ||
```js | ||
import {signal, computed} from '@preact/signals-core'; | ||
import {ThreadWebWorker, ThreadSignal} from '@quilted/threads'; | ||
// Old API: | ||
const result = signal(32); | ||
const serializedSignal = createThreadSignal(result); | ||
await thread.imports.calculateResult(serializedSignal); | ||
// New API: | ||
const result = signal(32); | ||
const serializedSignal = ThreadSignal.serialize(result); | ||
await thread.imports.calculateResult(serializedSignal); | ||
// In the target thread: | ||
// Old API: | ||
function calculateResult(resultThreadSignal) { | ||
const result = acceptThreadSignal(resultThreadSignal); | ||
const computedSignal = computed( | ||
() => `Result from thread: ${result.value}`, | ||
); | ||
// ... | ||
} | ||
// New API: | ||
function calculateResult(resultThreadSignal) { | ||
const result = new ThreadSignal(resultThreadSignal); | ||
const computedSignal = computed( | ||
() => `Result from thread: ${result.value}`, | ||
); | ||
// ... | ||
} | ||
``` | ||
## 2.1.0 | ||
@@ -4,0 +47,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"type": "module", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "engines": { |
@@ -20,3 +20,5 @@ /** | ||
export class NestedAbortController extends AbortController { | ||
constructor(...parents: AbortSignal[]) { | ||
constructor( | ||
...parents: Pick<AbortSignal, 'aborted' | 'reason' | 'addEventListener'>[] | ||
) { | ||
super(); | ||
@@ -23,0 +25,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
161234
2227