mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 03:43:50 +00:00
dce87c3a81
* inti relative mode * send imediat update on mode change * add relative to test * don't persist offset mode * add test relative and update calc function * pass data from ssocket * add dev guard * spelling and comments * show relative in offset overview * remove comments * refactor: move totalDelay to _rundown * update clear naming and comments * remove old testing values
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import { TimerPhase, Playback, OffsetMode } from 'ontime-types';
|
|
import { deepmerge } from 'ontime-utils';
|
|
import type { RuntimeState } from '../runtimeState.js';
|
|
|
|
const baseState: RuntimeState = {
|
|
clock: 0,
|
|
currentBlock: {
|
|
block: null,
|
|
startedAt: null,
|
|
},
|
|
eventNow: null,
|
|
publicEventNow: null,
|
|
eventNext: null,
|
|
publicEventNext: null,
|
|
runtime: {
|
|
selectedEventIndex: null,
|
|
numEvents: 0,
|
|
offset: 0,
|
|
relativeOffset: 0,
|
|
plannedStart: 0,
|
|
plannedEnd: 0,
|
|
actualStart: null,
|
|
expectedEnd: null,
|
|
offsetMode: OffsetMode.Absolute,
|
|
},
|
|
timer: {
|
|
addedTime: 0,
|
|
current: null,
|
|
duration: null,
|
|
elapsed: null,
|
|
expectedFinish: null,
|
|
finishedAt: null,
|
|
phase: TimerPhase.None,
|
|
playback: Playback.Stop,
|
|
secondaryTimer: null,
|
|
startedAt: null,
|
|
},
|
|
_timer: {
|
|
forceFinish: null,
|
|
pausedAt: null,
|
|
secondaryTarget: null,
|
|
},
|
|
_rundown: {
|
|
totalDelay: 0,
|
|
},
|
|
};
|
|
|
|
export function makeRuntimeStateData(patch?: Partial<RuntimeState>): RuntimeState {
|
|
return deepmerge(baseState, patch) as RuntimeState;
|
|
}
|