mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 21:03:29 +00:00
refactor: runtime side effects
This commit is contained in:
committed by
Carlos Valente
parent
accdf2c396
commit
6e61a7ecf9
@@ -1,7 +1,7 @@
|
||||
import { LogOrigin } from 'ontime-types';
|
||||
|
||||
import IIntegration, { TimerLifeCycleKey } from './IIntegration.js';
|
||||
import { getState } from '../../stores/runtimeState.js';
|
||||
import { eventStore } from '../../stores/EventStore.js';
|
||||
import { logger } from '../../classes/Logger.js';
|
||||
|
||||
class IntegrationService {
|
||||
@@ -20,14 +20,7 @@ class IntegrationService {
|
||||
}
|
||||
|
||||
dispatch(action: TimerLifeCycleKey) {
|
||||
/**
|
||||
* We currently get the state from the runtimeState store
|
||||
* This solves an issue where the state is not updated until after the integrations have ran
|
||||
* The workaround solves the issue with the tradeoff of
|
||||
* - we do not have access to data outside runtimeState (eg: messages or auxtimers)
|
||||
* - we couple the integrationService to runtimeState
|
||||
*/
|
||||
const state = getState();
|
||||
const state = eventStore.poll();
|
||||
this.integrations.forEach((integration) => {
|
||||
integration.dispatch(action, state);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user