mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-01 12:29:10 +00:00
refactor: migrate triggers to new service
This commit is contained in:
committed by
Carlos Valente
parent
6c4d80158c
commit
1f71d4578c
@@ -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