Function Spawn

  • This prototype property decorator factory Spawns a Worker and wraps and assigns the resulting Remote to the decorated prototype property.

    Parameters

    Returns ((prototype, propertyKey) => void)

    A prototype property decorator.

      • (prototype, propertyKey): void
      • Parameters

        • prototype: object
        • propertyKey: PropertyKey

        Returns void

    Example

    Spawn a Worker:

    import { Spawn, type Thread } from '@sgrud/core';
    import { type ExampleWorker } from 'example-worker';

    export class ExampleWorkerHandler {

    ⁠@Spawn('example-worker')
    public readonly worker!: Thread<ExampleWorker>;

    }

    See

    Thread

Generated using TypeDoc