Refactoring
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
import { getContext, setContext } from 'svelte';
|
||||
import { ProjectManager } from '../project-system/project-manager';
|
||||
import { ProjectDatabase } from '../project-system/db';
|
||||
import { createCsoundStore } from '../csound/store';
|
||||
import { createEditorSettingsStore } from '../stores/editorSettings';
|
||||
import { ProjectEditor } from '../stores/projectEditor.svelte';
|
||||
import { UIState } from '../stores/uiState.svelte';
|
||||
import type { CsoundStore } from '../csound/store';
|
||||
import type { EditorSettingsStore } from '../stores/editorSettings';
|
||||
|
||||
@ -11,17 +13,20 @@ export interface AppContext {
|
||||
csound: CsoundStore;
|
||||
editorSettings: EditorSettingsStore;
|
||||
projectEditor: ProjectEditor;
|
||||
uiState: UIState;
|
||||
}
|
||||
|
||||
const APP_CONTEXT_KEY = Symbol('app-context');
|
||||
|
||||
export function createAppContext(): AppContext {
|
||||
const projectManager = new ProjectManager();
|
||||
const db = new ProjectDatabase();
|
||||
const projectManager = new ProjectManager(db);
|
||||
return {
|
||||
projectManager,
|
||||
csound: createCsoundStore(),
|
||||
editorSettings: createEditorSettingsStore(),
|
||||
projectEditor: new ProjectEditor(projectManager)
|
||||
projectEditor: new ProjectEditor(projectManager),
|
||||
uiState: new UIState()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user