mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 12:23:51 +00:00
refactor: migrate triggers to new service
This commit is contained in:
committed by
Carlos Valente
parent
6c4d80158c
commit
1f71d4578c
@@ -17,6 +17,13 @@ export function getAutomationSettings(): AutomationSettings {
|
||||
return structuredClone(getDataProvider().getAutomation());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the enabled status of the automations
|
||||
*/
|
||||
export function getAutomationsEnabled(): boolean {
|
||||
return getAutomationSettings().enabledAutomations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a copy of the stored automations
|
||||
*/
|
||||
|
||||
@@ -12,13 +12,17 @@ import { getState, type RuntimeState } from '../../stores/runtimeState.js';
|
||||
|
||||
import { emitOSC } from './clients/osc.client.js';
|
||||
import { emitHTTP } from './clients/http.client.js';
|
||||
import { getAutomations, getBlueprints } from './automation.dao.js';
|
||||
import { getAutomations, getAutomationsEnabled, getBlueprints } from './automation.dao.js';
|
||||
import { isOntimeCloud } from '../../externals.js';
|
||||
|
||||
/**
|
||||
* Exposes a method for triggering actions based on a TimerLifeCycle event
|
||||
*/
|
||||
export function triggerAutomations(event: TimerLifeCycle, state: RuntimeState) {
|
||||
if (!getAutomationsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const automations = getAutomations();
|
||||
const triggerAutomations = automations.filter((automation) => automation.trigger === event);
|
||||
if (triggerAutomations.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user