-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathbackground.js
45 lines (43 loc) · 1.43 KB
/
background.js
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
(function(window, chrome) {
//Background Scope
var background = {};
window.background = background;
//Create window and add listeners
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('window.html', {
'state': 'fullscreen',
'bounds': {
'width': 1280,
'height': 1024
}
}, function(window) {
window.onClosed.addListener(function() {
background.setKeyboard(false);
chrome.power.releaseKeepAwake();
});
background.setKeyboard(true);
chrome.power.requestKeepAwake('display');
});
});
/**
* Enables or disables the on-screen keyboard.
* <p>
* If enable is true, the virtual keyboard of the ChromeOS
* accessibility features will be enabled. If false, this function will
* return the setting to its original value.
* @param {boolean} enable true to enable, or false to reset
* @returns {undefined}
*/
background.setKeyboard = function(enable) {
if (chrome.accessibilityFeatures) {
if (enable) {
chrome.accessibilityFeatures.virtualKeyboard.set({
value: enable
});
}
else {
chrome.accessibilityFeatures.virtualKeyboard.clear({});
}
}
};
})(window, chrome);