Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IParallel

Main facade used to start parallel tasks. Uses a chaining api. A new parallel task is created using a generator function like from, range or times. This returns an IParallelChain that is used to define the operations to perform on the elements. The parallel job is scheduled onto the thread pool as soon as a terminating function (IParallelChain.then, IParallelChain.catch, IParallelChain.subscribe or IParallelChain.reduce) is called.

Hierarchy

  • IParallel

Index

Methods

defaultOptions

from

  • Creates a new parallel chain that transforms the given array. The elements processed are distributed onto different workers.

    Type parameters

    • T

      type of the array elements

    Parameters

    • data: T[]

      the array with the elements

    • Optional options: IParallelOptions

      options options overriding the default options.

    Returns IParallelChain<T, __type, T>

range

  • Creates an array containing the elements in the range from start (inclusive) to end (exclusive) with the step size of step.

    throws

    if step size is equal to zero

    Parameters

    • start: number

      the start of the range or the end, if the function is called with a single argument

    • Optional end: undefined | number

      the end of the range

    • Optional step: undefined | number

      the step size.

    • Optional options: IParallelOptions

      options configuring the computation behaviour

    Returns IParallelChain<number, __type, number>

run

  • run<TResult>(func: function): ITask<TResult>
  • run<TParam1, TResult>(func: function, param1: TParam1): ITask<TResult>
  • run<TParam1, TParam2, TResult>(func: function, param1: TParam1, param2: TParam2): ITask<TResult>
  • run<TParam1, TParam2, TParam3, TResult>(func: function, param1: TParam1, param2: TParam2, param3: TParam3): ITask<TResult>
  • run<TParam1, TParam2, TParam3, TParam4, TResult>(func: function, param1: TParam1, param2: TParam2, param3: TParam3, param4: TParam4): ITask<TResult>
  • run<TParam1, TParam2, TParam3, TParam4, TParam5, TResult>(func: function, param1: TParam1, param2: TParam2, param3: TParam3, param4: TParam4, param5: TParam5): ITask<TResult>
  • run<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TResult>(func: function, param1: TParam1, param2: TParam2, param3: TParam3, param4: TParam4, param5: TParam5, param6: TParam6): ITask<TResult>
  • run<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TResult>(func: function, param1: TParam1, param2: TParam2, param3: TParam3, param4: TParam4, param5: TParam5, param6: TParam6, ...furtherParams: any[]): ITask<TResult>
  • run<TResult>(func: IFunctionId, ...params: any[]): ITask<TResult>
  • Runs the passed in function on an available worker. If no worker is available, then the function is queued until another task completes and therefore a worker is released.

    Type parameters

    • TResult

      the type of the result returned by the scheduled function

    Parameters

    • func: function

      the function to execute on the worker. The function is executed in the context of a worker (no shared memory) and therefore as limited access to global variables and the dom.

        • (this: void): TResult
        • Parameters

          • this: void

          Returns TResult

    Returns ITask<TResult>

    the scheduled task.

  • Type parameters

    • TParam1

      type of the parameter passed to the function

    • TResult

    Parameters

    • func: function
        • (this: void, param1: TParam1): TResult
        • Parameters

          • this: void
          • param1: TParam1

          Returns TResult

    • param1: TParam1

      sole parameter that is passed to the function

    Returns ITask<TResult>

  • Type parameters

    • TParam1

      type of the first parameter

    • TParam2

      type of the second function parameter

    • TResult

    Parameters

    • func: function
        • (this: void, param1: TParam1, param2: TParam2): TResult
        • Parameters

          • this: void
          • param1: TParam1
          • param2: TParam2

          Returns TResult

    • param1: TParam1

      the first parameter that is passed to the scheduled function

    • param2: TParam2

      the second parameter that is passed to the scheduled function

    Returns ITask<TResult>

  • Type parameters

    • TParam1

      type of the first parameter

    • TParam2

      type of the second function parameter

    • TParam3

      type of the third function parameter

    • TResult

    Parameters

    • func: function
        • (this: void, param1: TParam1, param2: TParam2, param3: TParam3): TResult
        • Parameters

          • this: void
          • param1: TParam1
          • param2: TParam2
          • param3: TParam3

          Returns TResult

    • param1: TParam1

      the first parameter that is passed to the scheduled function

    • param2: TParam2

      the second parameter that is passed to the scheduled function

    • param3: TParam3

      the third parameter that is passed to the scheduled function

    Returns ITask<TResult>

  • Type parameters

    • TParam1

      type of the first parameter

    • TParam2

      type of the second function parameter

    • TParam3

      type of the third function parameter

    • TParam4

      type of the fourth function parameter

    • TResult

    Parameters

    • func: function
        • (this: void, param1: TParam1, param2: TParam2, param3: TParam3, param4: TParam4): TResult
        • Parameters

          • this: void
          • param1: TParam1
          • param2: TParam2
          • param3: TParam3
          • param4: TParam4

          Returns TResult

    • param1: TParam1

      the first parameter that is passed to the scheduled function

    • param2: TParam2

      the second parameter that is passed to the scheduled function

    • param3: TParam3

      the third parameter that is passed to the scheduled function

    • param4: TParam4

      the fourth parameter that is passed to the scheduled function

    Returns ITask<TResult>

  • Type parameters

    • TParam1

      type of the first parameter

    • TParam2

      type of the second function parameter

    • TParam3

      type of the third function parameter

    • TParam4

      type of the fourth function parameter

    • TParam5

      type of the fifth function parameter

    • TResult

    Parameters

    • func: function
        • (this: void, param1: TParam1, param2: TParam2, param3: TParam3, param4: TParam4, param5: TParam5): TResult
        • Parameters

          • this: void
          • param1: TParam1
          • param2: TParam2
          • param3: TParam3
          • param4: TParam4
          • param5: TParam5

          Returns TResult

    • param1: TParam1

      the first parameter that is passed to the scheduled function

    • param2: TParam2

      the second parameter that is passed to the scheduled function

    • param3: TParam3

      the third parameter that is passed to the scheduled function

    • param4: TParam4

      the fourth parameter that is passed to the scheduled function

    • param5: TParam5

      the fifth parameter that is passed to the scheduled function

    Returns ITask<TResult>

  • Type parameters

    • TParam1

      type of the first parameter

    • TParam2

      type of the second function parameter

    • TParam3

      type of the third function parameter

    • TParam4

      type of the fourth function parameter

    • TParam5

      type of the fifth function parameter

    • TParam6

      type of the sixth function parameter

    • TResult

    Parameters

    • func: function
        • (this: void, param1: TParam1, param2: TParam2, param3: TParam3, param4: TParam4, param5: TParam5, param6: TParam6): TResult
        • Parameters

          • this: void
          • param1: TParam1
          • param2: TParam2
          • param3: TParam3
          • param4: TParam4
          • param5: TParam5
          • param6: TParam6

          Returns TResult

    • param1: TParam1

      the first parameter that is passed to the scheduled function

    • param2: TParam2

      the second parameter that is passed to the scheduled function

    • param3: TParam3

      the third parameter that is passed to the scheduled function

    • param4: TParam4

      the fourth parameter that is passed to the scheduled function

    • param5: TParam5

      the fifth parameter that is passed to the scheduled function

    • param6: TParam6

      the sixth parameter that is passed to the scheduled function

    Returns ITask<TResult>

  • Type parameters

    • TParam1

      type of the first parameter

    • TParam2

      type of the second function parameter

    • TParam3

      type of the third function parameter

    • TParam4

      type of the fourth function parameter

    • TParam5

      type of the fifth function parameter

    • TParam6

      type of the sixth function parameter

    • TResult

    Parameters

    • func: function
        • (this: void, param1: TParam1, param2: TParam2, param3: TParam3, param4: TParam4, param5: TParam5, param6: TParam6, ...furtherParams: any[]): TResult
        • Parameters

          • this: void
          • param1: TParam1
          • param2: TParam2
          • param3: TParam3
          • param4: TParam4
          • param5: TParam5
          • param6: TParam6
          • Rest ...furtherParams: any[]

          Returns TResult

    • param1: TParam1

      the first parameter that is passed to the scheduled function

    • param2: TParam2

      the second parameter that is passed to the scheduled function

    • param3: TParam3

      the third parameter that is passed to the scheduled function

    • param4: TParam4

      the fourth parameter that is passed to the scheduled function

    • param5: TParam5

      the fifth parameter that is passed to the scheduled function

    • param6: TParam6

      the sixth parameter that is passed to the scheduled function

    • Rest ...furtherParams: any[]

      further params that are passed to the scheduled function

    Returns ITask<TResult>

  • Schedules the function with the given id

    Type parameters

    • TResult

    Parameters

    • func: IFunctionId

      the id of the function

    • Rest ...params: any[]

      the params to pass to the function

    Returns ITask<TResult>

times

Generated using TypeDoc