Skip to content

Commit

Permalink
Export more types (#416)
Browse files Browse the repository at this point in the history
This allows code using workerpool to easily reference pool types.
  • Loading branch information
joshkel committed Dec 18, 2023
1 parent 72d531f commit 8214e90
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/index.js
@@ -1,16 +1,20 @@
const {platform, isMainThread, cpus} = require('./environment');

/** @typedef {import("./Pool")} Pool */
/** @typedef {import("./types.js").WorkerPoolOptions} WorkerPoolOptions */
/** @typedef {import("./types.js").WorkerRegisterOptions} WorkerRegisterOptions */

/**
* @overload
* Create a new worker pool
* @param {import("./types.js").WorkerPoolOptions} [script]
* @param {WorkerPoolOptions} [script]
* @returns {Pool} pool
*/
/**
* @overload
* Create a new worker pool
* @param {string} [script]
* @param {import("./types.js").WorkerPoolOptions} [options]
* @param {WorkerPoolOptions} [options]
* @returns {Pool} pool
*/
function pool(script, options) {
Expand All @@ -23,7 +27,7 @@ exports.pool = pool;
/**
* Create a worker and optionally register a set of methods to the worker.
* @param {{ [k: string]: (...args: any[]) => any }} [methods]
* @param {import("./types.js").WorkerRegisterOptions} [options]
* @param {WorkerRegisterOptions} [options]
*/
function worker(methods, options) {
var worker = require('./worker');
Expand Down

0 comments on commit 8214e90

Please sign in to comment.