mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 12:53:32 +00:00
chore: improve convention entry <> event
This commit is contained in:
committed by
Carlos Valente
parent
4180d0a337
commit
166be66ce3
@@ -2,24 +2,24 @@ import type { EndAction, EntryCustomFields, MaybeNumber, TimerType, TimeStrategy
|
||||
|
||||
export type EntryId = string;
|
||||
|
||||
export enum SupportedEvent {
|
||||
export enum SupportedEntry {
|
||||
Event = 'event',
|
||||
Delay = 'delay',
|
||||
Block = 'block',
|
||||
}
|
||||
|
||||
export type OntimeBaseEvent = {
|
||||
type: SupportedEvent;
|
||||
type: SupportedEntry;
|
||||
id: EntryId;
|
||||
};
|
||||
|
||||
export type OntimeDelay = OntimeBaseEvent & {
|
||||
type: SupportedEvent.Delay;
|
||||
type: SupportedEntry.Delay;
|
||||
duration: number;
|
||||
};
|
||||
|
||||
export type OntimeBlock = OntimeBaseEvent & {
|
||||
type: SupportedEvent.Block;
|
||||
type: SupportedEntry.Block;
|
||||
title: string;
|
||||
note: string;
|
||||
events: EntryId[];
|
||||
@@ -36,7 +36,7 @@ export type OntimeBlock = OntimeBaseEvent & {
|
||||
};
|
||||
|
||||
export type OntimeEvent = OntimeBaseEvent & {
|
||||
type: SupportedEvent.Event;
|
||||
type: SupportedEntry.Event;
|
||||
cue: string;
|
||||
title: string;
|
||||
note: string;
|
||||
|
||||
@@ -11,7 +11,7 @@ export {
|
||||
type OntimeEvent,
|
||||
type PlayableEvent,
|
||||
type TimeField,
|
||||
SupportedEvent,
|
||||
SupportedEntry as SupportedEntry,
|
||||
} from './definitions/core/OntimeEvent.type.js';
|
||||
export type {
|
||||
OntimeEntryCommonKeys,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { AutomationOutput, HTTPOutput, OntimeAction, OSCOutput } from '../definitions/core/Automation.type.js';
|
||||
import type { OntimeBlock, OntimeDelay, OntimeEvent, PlayableEvent } from '../definitions/core/OntimeEvent.type.js';
|
||||
import { SupportedEvent } from '../definitions/core/OntimeEvent.type.js';
|
||||
import { SupportedEntry } from '../definitions/core/OntimeEvent.type.js';
|
||||
import type { OntimeEntry } from '../definitions/core/Rundown.type.js';
|
||||
import { type TimerLifeCycle, timerLifecycleValues } from '../definitions/core/TimerLifecycle.type.js';
|
||||
|
||||
type MaybeEvent = OntimeEntry | Partial<OntimeEntry> | null | undefined;
|
||||
|
||||
export function isOntimeEvent(event: MaybeEvent): event is OntimeEvent {
|
||||
return event?.type === SupportedEvent.Event;
|
||||
return event?.type === SupportedEntry.Event;
|
||||
}
|
||||
|
||||
export function isPlayableEvent(event: OntimeEvent): event is PlayableEvent {
|
||||
@@ -15,11 +15,11 @@ export function isPlayableEvent(event: OntimeEvent): event is PlayableEvent {
|
||||
}
|
||||
|
||||
export function isOntimeDelay(event: MaybeEvent): event is OntimeDelay {
|
||||
return event?.type === SupportedEvent.Delay;
|
||||
return event?.type === SupportedEntry.Delay;
|
||||
}
|
||||
|
||||
export function isOntimeBlock(event: MaybeEvent): event is OntimeBlock {
|
||||
return event?.type === SupportedEvent.Block;
|
||||
return event?.type === SupportedEntry.Block;
|
||||
}
|
||||
|
||||
type AnyKeys<T> = keyof T;
|
||||
|
||||
Reference in New Issue
Block a user