-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] CoreViewPlugin: Remove access to dispatch
The CoreView plugins have a local state that is directly derived from the core data. As such, they should not have any impact on plugins other than themselves, especially not on core plugins. This revision removes the dispatch fro the core view plugins altogether as they don't and should not dispatch anything. Task: 4241403
- Loading branch information
Showing
15 changed files
with
118 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Session } from "../collaborative/session"; | ||
import { ModelConfig } from "../model"; | ||
import { SelectionStreamProcessor } from "../selection_stream/selection_stream_processor"; | ||
import { StateObserver } from "../state_observer"; | ||
import { ClientPosition, Color, Command, Currency, Getters } from "../types/index"; | ||
import { BasePlugin } from "./base_plugin"; | ||
import { UIActions } from "./ui_plugin"; | ||
|
||
export interface CoreViewPluginConfig { | ||
readonly getters: Getters; | ||
readonly stateObserver: StateObserver; | ||
readonly selection: SelectionStreamProcessor; | ||
readonly moveClient: (position: ClientPosition) => void; | ||
readonly uiActions: UIActions; | ||
readonly custom: ModelConfig["custom"]; | ||
readonly session: Session; | ||
readonly defaultCurrency?: Partial<Currency>; | ||
readonly customColors: Color[]; | ||
} | ||
|
||
export interface CoreViewPluginConstructor { | ||
new (config: CoreViewPluginConfig): CoreViewPlugin; | ||
getters: readonly string[]; | ||
} | ||
|
||
/** | ||
* Core view plugins handle any data derived from core date (i.e. evaluation). | ||
* They cannot impact the model data (i.e. cannot dispatch commands). | ||
*/ | ||
export class CoreViewPlugin<State = any> extends BasePlugin<State, Command> { | ||
protected getters: Getters; | ||
constructor({ getters, stateObserver }: CoreViewPluginConfig) { | ||
super(stateObserver); | ||
this.getters = getters; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.