feat: operator view

This commit is contained in:
cv
2023-08-28 21:42:27 +02:00
parent 9886e986d3
commit 32f18d8d23
32 changed files with 399 additions and 316 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
// runtime utils
export { getFirst, getNext, getPrevious } from './src/rundown-utils/rundownUtils.js';
export { getFirst, getLastEvent, getNext, getPrevious } from './src/rundown-utils/rundownUtils.js';
export { validatePlayback } from './src/validate-action/validatePlayback.js';
// rundown utils
@@ -26,6 +26,21 @@ export function getFirstEvent(rundown: OntimeRundownEntry[]) {
return null;
}
export function getLastEvent(rundown: OntimeRundown): OntimeEvent | null {
if (rundown.length < 1) {
return null;
}
for (let i = rundown.length - 1; i > 0; i--) {
const event = rundown.at(i);
if (isOntimeEvent(event)) {
return event;
}
}
return null;
}
/**
* Gets next event in rundown, if it exists
* @param {OntimeRundownEntry[]} rundown