0.1.5 • Published 6 months ago
@types/cluster-hub v0.1.5
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
// Type definitions for cluster-hub 0.1
// Project: https://github.com/sirian/node-cluster-hub#readme
// Definitions by: Chun-Kai Wang <https://github.com/chunkai1312>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Worker } from 'cluster';
export = Hub;
declare class Hub {
constructor(messageKey?: string);
on(type: string, listener: (...args: any[]) => void): this;
sendToMaster(type: string, data?: any): boolean;
sendToWorker(worker: Worker, type: string, data?: any): boolean;
sendToRandomWorker(type: string, data?: any): boolean;
sendToWorkers(type: string, data?: any): boolean;
requestMaster(type: string, data?: any, callback?: Hub.Callback): boolean;
requestWorker(worker: Worker, type: string, data?: any, callback?: Hub.Callback): boolean;
requestAllWorkers(type: string, data?: any, callback?: Hub.Callback): boolean;
requestRandomWorker(type: string, 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: Sat, 03 Jul 2021 00:31:25 GMT
- Dependencies: @types/node
- Global values: none
Credits
These definitions were written by Chun-Kai Wang.