Skip to content

oracular / createEndRecord

Function: createEndRecord() ​

ts
function createEndRecord(at, opts): EndRecord;

Defined in: recorder.ts:137

A recorder record for the end of an episode. Write one whenever the app calls endEpisode, with the same at, so that replay can end the episode at the same moment and reproduce the misses it records. Episodes that close through episodeTimeout need none: replay applies the timeout itself.

Parameters ​

ParameterTypeDescription
atnumberThe time passed to endEpisode.
optsRecordOptionsThe same options as for createRecord; top is accepted and ignored.

Returns ​

EndRecord

A plain, JSON-serializable EndRecord.

Throws ​

TypeError when at is not a finite number or opts is malformed.

Throws ​

RangeError when opts.top is negative or fractional.

Example ​

ts
const at = Date.now();
state = endEpisode(state, at);
appendLine(JSON.stringify(createEndRecord(at, recording)));

Released under the MIT License.