Make getBackground async
This commit is contained in:
parent
a57363f1c0
commit
76e170686a
6 changed files with 198 additions and 175 deletions
|
@ -72,8 +72,18 @@
|
|||
chrome.windows.remove(windowId);
|
||||
},
|
||||
|
||||
getBackground: function() {
|
||||
return chrome.extension.getBackgroundPage();
|
||||
getBackground: function(callback) {
|
||||
if (chrome.extension) {
|
||||
return new Promise(function(resolve) {
|
||||
callback(chrome.extension.getBackgroundPage());
|
||||
resolve();
|
||||
});
|
||||
} else if (chrome.runtime) {
|
||||
return new Promise(function(resolve) {
|
||||
chrome.runtime.getBackgroundPage(callback);
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getViews: function() {
|
||||
|
@ -96,4 +106,11 @@
|
|||
return localStorage.getItem("chromiumRegistrationDone") !== null;
|
||||
},
|
||||
};
|
||||
|
||||
chrome.app.runtime.onLaunched.addListener(function() {
|
||||
chrome.app.window.create('index.html', {
|
||||
id: 'main',
|
||||
bounds: { width: 620, height: 500 }
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue