-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #624 from tuanchauict/browser-js
Integrate BrowserManager into AppContext
- Loading branch information
Showing
4 changed files
with
43 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,42 @@ | ||
import { TODO } from "$libs/todo"; | ||
import { ShapeManager } from "$mono/shape/shape-manager"; | ||
import { WorkspaceDao } from "$mono/store-manager/dao/workspace-dao"; | ||
import { BrowserManager } from "$mono/window/browser-manager"; | ||
import { LifecycleOwner } from 'lib/libs/flow'; | ||
import { AppUiStateManager } from '$mono/ui-state-manager'; | ||
|
||
/** | ||
* Main class of the app to handle all kinds of events, UI, actions, etc. | ||
*/ | ||
export class AppContext { | ||
appLifecycleOwner = new LifecycleOwner(); | ||
|
||
appUiStateManager = new AppUiStateManager(this.appLifecycleOwner); | ||
|
||
shapeManager = new ShapeManager(); | ||
|
||
onStart = (): void => { | ||
this.appLifecycleOwner.onStart(); | ||
|
||
this.init(); | ||
|
||
this.appUiStateManager.observeTheme(() => { | ||
console.log('Theme changed'); | ||
// TODO: Update theme in the workspace | ||
}); | ||
}; | ||
|
||
private init() { | ||
const browserManager = new BrowserManager((url: string) => { | ||
console.log('URL updated:', url); | ||
// TODO: Update the workspace based on the URL | ||
TODO("Update the workspace based on the URL"); | ||
}); | ||
browserManager.startObserveStateChange( | ||
this.shapeManager.rootIdFlow, | ||
this.appLifecycleOwner, | ||
WorkspaceDao.instance); | ||
|
||
// TODO: Replicate from MonoSketchApplication | ||
} | ||
} |
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