gameplate - v2.3.0
    Preparing search index...

    Function replay

    • Deterministically re-apply a Recording against the given action map.

      Pure: the result depends only on recording and actions. Throws if the recording references an action that's not in actions (a version mismatch).

      Type Parameters

      • S

      Parameters

      Returns DeepReadonly<S>

      const final = replay(recording, actions);
      
      const stateAt5 = replay(recording, actions, { until: 5 });
      
      const history: State[] = [recording.initialState];
      replay(recording, actions, { onTick: (s) => history.push(s) });