Selva Compute API Reference - v2.1.0
    Preparing search index...

    Class SolveScheduler

    Robust scheduler for Grasshopper solves.

    Sits between your application code and the underlying compute call, adding:

    • Configurable scheduling (latest-wins for sliders, queue for jobs)
    • In-flight cancellation (per-call signal + cancelAll)
    • Optional response caching for repeated inputs
    • Lifecycle hooks for UI indicators (start / settle / superseded)
    • State observability via subscribe()

    Multiple schedulers can share a single GrasshopperClient — typically one per UI surface (e.g. one for slider scrubs, one for long-running submits).

    const scheduler = client.createScheduler({ mode: 'latest-wins', timeoutMs: 30_000 });

    // From a slider handler:
    scheduler.solve(definition, tree).then((result) => {
    updateMeshes(result);
    }).catch((err) => {
    if (err.code !== 'SUPERSEDED') showError(err);
    });

    // From a UI binding:
    scheduler.subscribe(() => {
    showSpinner = scheduler.isSolving;
    });
    Index

    Constructors

    Accessors

    Methods

    • Schedule a solve. Returns a promise that:

      • Resolves with the compute response on success.
      • Rejects with RhinoComputeError on failure.
      • Rejects with code: ErrorCodes.SUPERSEDED when the call was canceled because newer values arrived (latest-wins mode).
      • Rejects with code: ErrorCodes.ABORTED when the call was canceled via caller-supplied signal or cancelAll().

      Caller-supplied signal cancels just this call (rejects with ABORTED).

      Parameters

      Returns Promise<GrasshopperComputeResponse>