footprintjs - v11.2.0
    Preparing search index...

    Function interrupt

    • Pause the run and ask for an answer.

      On the first pass there is no answer pending, so this THROWS an InterruptSignal: the engine commits the stage's writes, builds the normal FlowchartCheckpoint with pauseData = your payload, and run() returns { paused: true, checkpoint }. Hand the checkpoint and the answer to executor.resume(checkpoint, answer) and the stage runs again from its top — this time the call returns answer.

      Type Parameters

      • T = unknown

      Parameters

      • scope: unknown

        The stage's scope (first argument, like decide()).

      • payload: InterruptPayload

        { reason, expects? } — carried verbatim to the checkpoint.

      Returns T

      The resume input, typed as T. The engine does not validate it against expects — declare the shape you want and check it if the answer comes from somewhere you do not control.

      const decision = interrupt<{ approved: boolean }>(scope, { reason: 'Ship it?' });
      if (!decision.approved) scope.$break('rejected by reviewer');