Skip to content

Commit

Permalink
fix(workers): export missing types from definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Wayne Van Son committed Aug 4, 2024
1 parent 286b92a commit a4af165
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/workers/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Accessor, Setter, createEffect, on, onCleanup } from "solid-js";
import { isServer } from "solid-js/web";
import type { PostMessageOptions, WorkerCallbacks, WorkerExports, WorkerMessage } from "./types.js";
import { KILL, RPC, cjs, setup } from "./utils.js";

import { cjs, setup, KILL, RPC } from "./utils.js";
export type * from "./types.js";

/**
* Creates a very basic WebWorker based on provided code.
Expand Down
10 changes: 5 additions & 5 deletions packages/workers/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
declare type WorkerSignal = number;
export type WorkerSignal = number;

declare type WorkerCallbacks = Map<string, [succes: Function, error: Function]>;
export type WorkerCallbacks = Map<string, [succes: Function, error: Function]>;

declare type WorkerMessage = {
export type WorkerMessage = {
type: WorkerSignal;
id?: string;
error?: string;
Expand All @@ -12,13 +12,13 @@ declare type WorkerMessage = {
params?: any;
};

declare type WorkerExports = [
export type WorkerExports = [
worker: Worker,
start: () => void,
stop: () => void,
exports?: Set<string>,
];

declare interface PostMessageOptions {
export interface PostMessageOptions {
transfer?: any[] | undefined;
}
2 changes: 2 additions & 0 deletions packages/workers/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { WorkerSignal, WorkerCallbacks, WorkerMessage } from "./types.js";

export const KILL: WorkerSignal = 0;
export const RPC: WorkerSignal = 1;

Expand Down

0 comments on commit a4af165

Please sign in to comment.