-
Notifications
You must be signed in to change notification settings - Fork 4
/
background.js
43 lines (36 loc) · 974 Bytes
/
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
var nid = 'main';
var ctd = false;
var extID = 'ppibnbapebejhnmplokgfhijhfdchhhc'; // catcher links extension
var appID = 'gkcknpgdmiigoagkcoglklgaagnpojed'; // this app
var frame = 'none';
// frame options
chrome.storage.sync.get(function(items) {
if (items.showFrame !== undefined) {
frame = items.showFrame;
}
});
var app = function() {
chrome.app.window.create(
'index.html',
{
id: 'mainWindow',
innerBounds: { width: 960, height: 600 },
frame: { type: frame },
resizable: true
},
function(e) {
}
);
}
chrome.app.runtime.onLaunched.addListener(function() {
app();
});
chrome.app.runtime.onRestarted.addListener(function() {
app();
});
// send cached links to webview
chrome.runtime.onMessageExternal.addListener(function(request, sender) {
if (sender.id == extID) {
chrome.runtime.sendMessage(appID, request);
}
});