mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-11 18:33:53 +00:00
refactor: type improvements (#751)
This commit is contained in:
@@ -34,18 +34,10 @@ export class HttpIntegration implements IIntegration<HttpSubscriptionOptions> {
|
||||
}
|
||||
|
||||
this.initSubscriptions(subscriptions);
|
||||
|
||||
try {
|
||||
return {
|
||||
success: true,
|
||||
message: `HTTP integration client ready`,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
success: false,
|
||||
message: `Failed initialising HTTP integration: ${error}`,
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
message: 'HTTP integration client ready',
|
||||
};
|
||||
}
|
||||
|
||||
initSubscriptions(subscriptionOptions: HttpSubscription) {
|
||||
|
||||
@@ -99,6 +99,10 @@ export class OscIntegration implements IIntegration<OscSubscriptionOptions> {
|
||||
}
|
||||
|
||||
emit(path: string, payload?: ArgumentType) {
|
||||
if (!this.oscClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
const message = new Message(path);
|
||||
if (payload) {
|
||||
try {
|
||||
|
||||
@@ -14,8 +14,6 @@ import * as runtimeState from '../../stores/runtimeState.js';
|
||||
class RuntimeService {
|
||||
private eventTimer: TimerService | null = null;
|
||||
|
||||
constructor() {}
|
||||
|
||||
init(resumable: RestorePoint | null) {
|
||||
logger.info(LogOrigin.Server, 'Runtime service started');
|
||||
// TODO: refresh at 32ms, slowing down now to keep UI responsive while we dont have granular updates
|
||||
@@ -339,6 +337,11 @@ class RuntimeService {
|
||||
const { selectedEventId, playback } = restorePoint;
|
||||
if (playback === Playback.Roll) {
|
||||
this.roll();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!selectedEventId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// the db would have to change for the event not to exist
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MaybeNumber, OntimeEvent, TimerType } from 'ontime-types';
|
||||
import { MaybeNumber, MaybeString, OntimeEvent, TimerType } from 'ontime-types';
|
||||
import { dayInMs } from 'ontime-utils';
|
||||
import { RuntimeState } from '../stores/runtimeState.js';
|
||||
import { sortArrayByProperty } from '../utils/arrayUtils.js';
|
||||
@@ -94,13 +94,26 @@ export function skippedOutOfEvent(state: RuntimeState, previousTime: number, ski
|
||||
return hasSkipped && (adjustedClock > adjustedExpectedFinish || adjustedClock < startedAt);
|
||||
}
|
||||
|
||||
type RollTimers = {
|
||||
nowIndex: MaybeNumber;
|
||||
nowId: MaybeString;
|
||||
publicIndex: MaybeNumber;
|
||||
nextIndex: MaybeNumber;
|
||||
publicNextIndex: MaybeNumber;
|
||||
timeToNext: MaybeNumber;
|
||||
nextEvent: OntimeEvent | null;
|
||||
nextPublicEvent: OntimeEvent | null;
|
||||
currentEvent: OntimeEvent | null;
|
||||
currentPublicEvent: OntimeEvent | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Finds loading information given a current rundown and time
|
||||
* @param {OntimeEvent[]} rundown - List of playable events
|
||||
* @param {number} timeNow - time now in ms
|
||||
* @returns {{}}
|
||||
*/
|
||||
export const getRollTimers = (rundown: OntimeEvent[], timeNow: number) => {
|
||||
export const getRollTimers = (rundown: OntimeEvent[], timeNow: number): RollTimers => {
|
||||
let nowIndex: number | null = null; // index of event now
|
||||
let nowId: string | null = null; // id of event now
|
||||
let publicIndex: number | null = null; // index of public event now
|
||||
|
||||
Reference in New Issue
Block a user