refactor: migrate triggers to new service

This commit is contained in:
Carlos Valente
2025-01-11 16:02:23 +01:00
committed by Carlos Valente
parent 6c4d80158c
commit 1f71d4578c
3 changed files with 26 additions and 13 deletions
@@ -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) {