import { reaction } from "mobx" ; import { lazyInject } from "../inversify.config" ; import AutoReloadService from "../services/AutoReloadService" ; import SonarQubeMeasuresService from "../services/sonarqube/measures/SonarQubeMeasuresService" ; import ComponentStatusStore from "../stores/ComponentStatusStore" ; export default class AppReactions { @ lazyInject ( "SonarQubeMeasuresService" ) private readonly measuresService ! : SonarQubeMeasuresService ; @ lazyInject ( "AutoReloadService" ) private readonly autoReloadService ! : AutoReloadService ; @ lazyInject ( "ComponentStatusStore" ) private readonly componentStatusStore ! : ComponentStatusStore ; constructor ( ) { this . prepareReactions ( ) ; } private prepareReactions ( ) { reaction ( ( ) => this . componentStatusStore . lastAnalysisDate , ( ) => { if ( this . autoReloadService . isActive ( ) ) { this . measuresService . loadMeasures ( true ) ; } else { return ; } } , { name : "Reload measures." , } ) ; } }