Refactor to add readonly interfaces

Using more granular interfaces adds to expressiveness of the code.
Knowing what needs to mutate the state explicitly helps easier
understanding of the code and therefore increases the maintainability.
This commit is contained in:
undergroundwires
2021-12-24 21:14:27 +01:00
parent a1871a2982
commit c3c5b897f3
16 changed files with 58 additions and 42 deletions

View File

@@ -1,12 +1,16 @@
import { ICategoryCollectionState } from './State/ICategoryCollectionState';
import { ICategoryCollectionState, IReadOnlyCategoryCollectionState } from './State/ICategoryCollectionState';
import { OperatingSystem } from '@/domain/OperatingSystem';
import { IEventSource } from '@/infrastructure/Events/IEventSource';
import { IApplication } from '@/domain/IApplication';
export interface IApplicationContext {
export interface IReadOnlyApplicationContext {
readonly app: IApplication;
readonly state: ICategoryCollectionState;
readonly state: IReadOnlyCategoryCollectionState;
readonly contextChanged: IEventSource<IApplicationContextChangedEvent>;
}
export interface IApplicationContext extends IReadOnlyApplicationContext {
readonly state: ICategoryCollectionState;
changeContext(os: OperatingSystem): void;
}