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

@quilted/threads

Package Overview
Dependencies
Maintainers
0
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@quilted/threads - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

build/esm/targets/service-worker/browser.mjs

2

build/typescript/index.d.ts
export { retain, release, StackFrame, isMemoryManageable, markAsTransferable, } from './memory.ts';
export type { MemoryManageable, MemoryRetainer } from './memory.ts';
export { RELEASE_METHOD, RETAIN_METHOD, RETAINED_BY, ENCODE_METHOD, TRANSFERABLE, } from './constants.ts';
export { createThread, createThreadFromBroadcastChannel, createThreadFromBrowserWebSocket, createThreadFromIframe, createThreadFromInsideIframe, createThreadFromMessagePort, createThreadFromWebWorker, type ThreadOptions, } from './targets.ts';
export { createThread, createThreadFromBroadcastChannel, createThreadFromBrowserWebSocket, createThreadFromIframe, createThreadFromInsideIframe, createThreadFromMessagePort, createThreadFromServiceWorker, createThreadsFromServiceWorkerClients, createThreadFromWebWorker, type ThreadOptions, type ServiceWorkerClientThreads, } from './targets.ts';
export { createBasicEncoder } from './encoding.ts';

@@ -6,0 +6,0 @@ export { createThreadAbortSignal, acceptThreadAbortSignal, type ThreadAbortSignal, } from './abort-signal.ts';

@@ -6,4 +6,6 @@ export { createThread, type ThreadOptions } from './targets/target.ts';

export { createThreadFromMessagePort } from './targets/message-port.ts';
export { createThreadFromServiceWorker } from './targets/service-worker/browser.ts';
export { createThreadsFromServiceWorkerClients, type ServiceWorkerClientThreads, } from './targets/service-worker/worker.ts';
export { createThreadFromBrowserWebSocket } from './targets/web-socket-browser.ts';
export { createThreadFromWebWorker } from './targets/web-worker.ts';
//# sourceMappingURL=targets.d.ts.map

@@ -21,3 +21,3 @@ import { type ThreadOptions } from './target.ts';

*/
export declare function createThreadFromWebWorker<Self = Record<string, never>, Target = Record<string, never>>(worker: Worker, options?: ThreadOptions<Self, Target>): import("../types.ts").Thread<Target>;
export declare function createThreadFromWebWorker<Self = Record<string, never>, Target = Record<string, never>>(worker: Pick<Worker, 'postMessage' | 'addEventListener'>, options?: ThreadOptions<Self, Target>): import("../types.ts").Thread<Target>;
//# sourceMappingURL=web-worker.d.ts.map
# @quilted/threads
## 2.3.0
### Minor Changes
- [`03d2cbb`](https://github.com/lemonmade/quilt/commit/03d2cbba9f099b0c207faa883980cf2a24b77aad) Thanks [@lemonmade](https://github.com/lemonmade)! - Add utilities for creating threads from service workers
## 2.2.0

@@ -4,0 +10,0 @@

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

"type": "module",
"version": "2.2.0",
"version": "2.3.0",
"license": "MIT",

@@ -8,0 +8,0 @@ "engines": {

@@ -61,2 +61,23 @@ # `@quilted/threads`

const thread = createThreadFromBroadcastChannel(channel);
// Create a thread from a service worker.
import {createThreadFromServiceWorker} from '@quilted/threads';
await navigator.serviceWorker.register('/service-worker.js');
if (navigator.serviceWorker.controller) {
const thread = createThreadFromServiceWorker(
navigator.serviceWorker.controller,
);
}
// Create threads between a service worker and clients that connect to it.
import {createThreadsFromServiceWorkerClients} from '@quilted/threads';
const clientThreads = createThreadsFromServiceWorkerClients();
self.addEventListener('activate', async (event) => {
const clients = await serviceWorker.clients.matchAll();
const thread = clientThreads.create(clients[0]);
});
```

@@ -63,0 +84,0 @@

@@ -23,4 +23,7 @@ export {

createThreadFromMessagePort,
createThreadFromServiceWorker,
createThreadsFromServiceWorkerClients,
createThreadFromWebWorker,
type ThreadOptions,
type ServiceWorkerClientThreads,
} from './targets.ts';

@@ -27,0 +30,0 @@ export {createBasicEncoder} from './encoding.ts';

@@ -6,3 +6,8 @@ export {createThread, type ThreadOptions} from './targets/target.ts';

export {createThreadFromMessagePort} from './targets/message-port.ts';
export {createThreadFromServiceWorker} from './targets/service-worker/browser.ts';
export {
createThreadsFromServiceWorkerClients,
type ServiceWorkerClientThreads,
} from './targets/service-worker/worker.ts';
export {createThreadFromBrowserWebSocket} from './targets/web-socket-browser.ts';
export {createThreadFromWebWorker} from './targets/web-worker.ts';

@@ -25,3 +25,6 @@ import {createThread, type ThreadOptions} from './target.ts';

Target = Record<string, never>,
>(worker: Worker, options?: ThreadOptions<Self, Target>) {
>(
worker: Pick<Worker, 'postMessage' | 'addEventListener'>,
options?: ThreadOptions<Self, Target>,
) {
return createThread(

@@ -28,0 +31,0 @@ {

{
"extends": "@quilted/typescript/tsconfig.project.json",
"extends": "@quilted/typescript/tsconfig.package.json",
"compilerOptions": {
"rootDir": "source",
"outDir": "build/typescript"
"lib": ["DOM", "webWorker", "ESNext"]
},
"include": ["source"],
"exclude": ["*.test.ts", "*.test.tsx"],
"references": [{"path": "../events"}]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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