parallel-es
Version:
Simple parallelization for EcmaScript
64 lines (63 loc) • 2.5 kB
TypeScript
/**
* @module parallel
*/
/** */
import { IFunctionId } from "./function-id";
import { ISerializedFunctionCall } from "./serialized-function-call";
/**
* Represents a function call
*/
export declare class FunctionCall {
/**
* Creates a new function call for a function without any arguments
* @param func the function to call
* @returns the function call
*/
static create(func: () => any): FunctionCall;
/**
* Creates a new function call to a function accepting a single argument
* @param func the function to call
* @param param1 the single parameter passed to the function
* @param TParam1 type of the single parameter
* @returns the function call
*/
static create<TParam1>(func: (arg1: TParam1) => any, param1: TParam1): FunctionCall;
/**
* Creates a new function call to a function passing the given parameters
* @param func the function to call
* @param param1 the first parameter to pass to the function
* @param param2 the second parameter to pass to the function
* @param TParam1 type of the first parameter
* @param TParam2 type of the second parameter
* @returns the function call
*/
static create<TParam1, TParam2>(func: (arg1: TParam1, arg2: TParam2) => any, param1: TParam1, param2: TParam2): FunctionCall;
/**
* @param param3 the third parameter to pass to the function
* @param TParam3 the type of the third parameter
*/
static create<TParam1, TParam2, TParam3>(func: (arg1: TParam1, arg2: TParam2, arg3: TParam3) => any, param1: TParam1, param2: TParam2, param3: TParam3): FunctionCall;
static create(func: IFunctionId, ...params: any[]): FunctionCall;
/**
* Creates a function call for a function with with many arguments
* @param func the function to call
* @param params the parameters to pass
* @returns the function call
*/
static createUnchecked(func: Function | IFunctionId, ...params: any[]): FunctionCall;
/**
* Creates a function call instance from its serialized representation
* @param serialized the serialized function call
* @returns {FunctionCall} the function call
*/
static fromSerialized(serialized: ISerializedFunctionCall): FunctionCall;
/**
* The function to call
*/
func: Function | IFunctionId;
/**
* The parameters to pass to the function when calling it
*/
params: any[];
private constructor(func, params);
}