Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@quilted/events

Package Overview
Dependencies
Maintainers
0
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@quilted/events - npm Package Compare versions

Comparing version 0.0.0-preview-20240731033135 to 0.0.0-preview-20240816174814

2

build/typescript/abort/NestedAbortController.d.ts

@@ -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
## 0.0.0-preview-20240731033135
## 0.0.0-preview-20240816174814
### Minor Changes
### Patch Changes
- Add `EventTargetSignal` class for converting an `EventTarget` into a Preact signal
- 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.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

@@ -10,0 +90,0 @@

@@ -5,3 +5,3 @@ {

"type": "module",
"version": "0.0.0-preview-20240731033135",
"version": "0.0.0-preview-20240816174814",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc