Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
matthewbauer
GitHub Repository: matthewbauer/gametime-player
Path: blob/master/background.js
1044 views
1
function newWindow() {
2
return new Promise(function(resolve, reject) {
3
chrome.app.window.create('index.html', {}, resolve)
4
})
5
}
6
7
function launch(file) {
8
return new Promise(function(resolve, reject) {
9
file.entry.file(resolve, reject)
10
}).then(function(blob) {
11
return newWindow().then(function(w) {
12
w.contentWindow.filename = blob.name
13
w.contentWindow.url = URL.createObjectURL(blob)
14
})
15
})
16
}
17
18
chrome.app.runtime.onLaunched.addListener(function(launchData) {
19
if (launchData.items)
20
launchData.items.forEach(launch)
21
else
22
newWindow()
23
})
24
25