-
-
Notifications
You must be signed in to change notification settings - Fork 199
Expand file tree
/
Copy pathmain.js
More file actions
69 lines (62 loc) · 2.18 KB
/
Copy pathmain.js
File metadata and controls
69 lines (62 loc) · 2.18 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*!
* Brackets Git Extension
*
* @author Martin Zagora
* @license http://opensource.org/licenses/MIT
*/
define(function (require, exports, module) {
// Brackets modules
const _ = brackets.getModule("thirdparty/lodash"),
AppInit = brackets.getModule("utils/AppInit"),
ExtensionUtils = brackets.getModule("utils/ExtensionUtils");
// Local modules
require("src/SettingsDialog");
const EventEmitter = require("src/EventEmitter"),
Events = require("src/Events"),
Main = require("src/Main"),
Preferences = require("src/Preferences"),
Git = require("src/git/Git"),
BracketsEvents = require("src/BracketsEvents");
// Load extension modules that are not included by core
var modules = [
"src/GutterManager",
"src/History",
"src/NoRepo",
"src/ProjectTreeMarks",
"src/Remotes",
"src/TabBarIntegration"
];
require(modules);
// Load CSS
if(Phoenix.config.environment === "dev"){
ExtensionUtils.loadStyleSheet(module, "styles/git-styles.less");
} else {
ExtensionUtils.loadStyleSheet(module, "styles/git-styles-min.css");
}
AppInit.appReady(function () {
function initMain() {
Main.init().then((enabled)=>{
if(!enabled) {
BracketsEvents.disableAll();
}
});
}
// Main.init emits events like GIT_ENABLED that the modules above listen
// for. They load asynchronously, so init must wait for them or events
// fired before they finish loading are lost (Eg. empty remotes picker).
require(modules, initMain, function (err) {
console.error("Git modules failed to load, initializing git anyway", err);
initMain();
});
});
// export API's for other extensions
if (typeof window === "object") {
const TabBarIntegration = require("src/TabBarIntegration");
window.phoenixGitEvents = {
EventEmitter: EventEmitter,
Events: Events,
Git,
TabBarIntegration
};
}
});