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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user