Installation
npm install --save @types/cluster-hub
Summary
This package contains type definitions for cluster-hub (https://github.com/sirian/node-cluster-hub#readme).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cluster-hub.
index.d.ts
/// <reference types="node" />
import { Worker } from "cluster";
import { EventEmitter } from "events";
export = Hub;
declare class Hub extends EventEmitter {
constructor(messageKey?: string);
sendToMaster(type: string | symbol, data?: any): boolean;
sendToWorker(worker: Worker, type: string | symbol, data?: any): boolean;
sendToRandomWorker(type: string | symbol, data?: any): boolean;
sendToWorkers(type: string | symbol, data?: any): boolean;
requestMaster(type: string | symbol, data?: any, callback?: Hub.Callback): boolean;
requestWorker(worker: Worker, type: string | symbol, data?: any, callback?: Hub.Callback): boolean;
requestAllWorkers(type: string | symbol, data?: any, callback?: Hub.Callback): boolean;
requestRandomWorker(type: string | symbol, data?: any, callback?: Hub.Callback): boolean;
lock(lockKey: string, callback?: (unlock: () => void) => void): boolean;
}
declare namespace Hub {
type Callback = (err: Error | null, response: any) => void;
}
Additional Details
- Last updated: Mon, 06 Nov 2023 22:41:05 GMT
- Dependencies: @types/node
Credits
These definitions were written by Chun-Kai Wang.