forked from humphd/brackets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrowser-appshell.js
More file actions
117 lines (107 loc) · 3.53 KB
/
Copy pathbrowser-appshell.js
File metadata and controls
117 lines (107 loc) · 3.53 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**
* Browser shim for Brackets AppShell API. See:
* https://github.com/adobe/brackets-shell
* https://github.com/adobe/brackets-shell/blob/adf27a65d501fae71cc6d8905d6dc3d9460208a9/appshell/appshell_extensions.js
* http://www.hyperlounge.com/blog/hacking-the-brackets-shell/
*/
(function(global, navigator) {
var startupTime = Date.now();
function getElapsedMilliseconds() {
return (Date.now()) - startupTime;
}
function functionNotImplemented() {
throw "Function not (yet) implemented in browser-appshell.";
}
// Provide an implementation of appshell.app as expected by src/utils/Global.js
// and other parts of the code.
var appshell = global.appshell = global.appshell || {};
appshell.app = {
ERR_NODE_FAILED: -3,
ERR_NODE_NOT_YET_STARTED: -1,
ERR_NODE_PORT_NOT_YET_SET: -2,
NO_ERROR: 0,
// TODO: deal with getter *and* setter
language: navigator.language,
abortQuit: function() {
functionNotImplemented();
},
addMenu: function(title, id, position, relativeId, callback) {
functionNotImplemented();
},
addMenuItem: function(parentId, title, id, key, displayStr, position, relativeId, callback) {
functionNotImplemented();
},
closeLiveBrowser: function(callback) {
functionNotImplemented();
},
dragWindow: function() {
functionNotImplemented();
},
getApplicationSupportDirectory: function() {
return '/ApplicationSupport';
},
getDroppedFiles: function(callback) {
functionNotImplemented();
},
getElapsedMilliseconds: getElapsedMilliseconds,
getMenuItemState: function(commandid, callback) {
functionNotImplemented();
},
getMenuPosition: function(commandId, callback) {
functionNotImplemented();
},
getMenuTitle: function(commandid, callback) {
functionNotImplemented();
},
getPendingFilesToOpen: function(callback) {
// No files are passed to the app on startup, unless we want to support
// URL based params with a list. For now return an empty array.
callback(null, []);
},
getRemoteDebuggingPort: function() {
functionNotImplemented();
},
getUserDocumentsDirectory: function() {
functionNotImplemented();
},
openLiveBrowser: function(url, enableRemoteDebugging, callback) {
functionNotImplemented();
},
openURLInDefaultBrowser: function(url, callback) {
global.open(url);
callback && callback();
},
quit: function() {
functionNotImplemented();
},
removeMenu: function(commandId, callback) {
functionNotImplemented();
},
removeMenuItem: function(commandId, callback) {
functionNotImplemented();
},
setMenuItemShortcut: function(commandId, shortcut, displayStr, callback) {
functionNotImplemented();
},
setMenuItemState: function(commandid, enabled, checked, callback) {
functionNotImplemented();
},
setMenuTitle: function(commandid, title, callback) {
functionNotImplemented();
},
showDeveloperTools: function() {
functionNotImplemented();
},
showExtensionsFolder: function(appURL, callback) {
functionNotImplemented();
},
showOSFolder: function(path, callback) {
functionNotImplemented();
},
// https://github.com/adobe/brackets-shell/blob/959836be7a3097e2ea3298729ebd616247c83dce/appshell/appshell_node_process.h#L30
getNodeState: function(callback) {
callback(/* BRACKETS_NODE_FAILED = -3 */ -3);
}
};
global.brackets = appshell;
}(window, window.navigator));