forked from marktext/marktext
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccessor.js
More file actions
41 lines (33 loc) · 1.26 KB
/
accessor.js
File metadata and controls
41 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import WindowManager from '../app/windowManager'
import Preference from '../preferences'
import DataCenter from '../dataCenter'
import Keybindings from '../keyboard/shortcutHandler'
import AppMenu from '../menu'
import { loadMenuCommands } from '../menu/actions'
import { CommandManager, loadDefaultCommands } from '../commands'
class Accessor {
/**
* @param {AppEnvironment} appEnvironment The application environment instance.
*/
constructor (appEnvironment) {
const userDataPath = appEnvironment.paths.userDataPath
this.env = appEnvironment
this.paths = appEnvironment.paths // export paths to make it better accessible
this.preferences = new Preference(this.paths)
this.dataCenter = new DataCenter(this.paths)
this.commandManager = CommandManager
this._loadCommands()
this.keybindings = new Keybindings(this.commandManager, appEnvironment)
this.menu = new AppMenu(this.preferences, this.keybindings, userDataPath)
this.windowManager = new WindowManager(this.menu, this.preferences)
}
_loadCommands () {
const { commandManager } = this
loadDefaultCommands(commandManager)
loadMenuCommands(commandManager)
if (this.env.isDevMode) {
commandManager.__verifyDefaultCommands()
}
}
}
export default Accessor