Fix: no need to access db
This commit is contained in:
parent
a8131fc9c5
commit
1b2c88f926
|
@ -17,14 +17,12 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, {
|
|||
installStyle: styleManager.installStyle,
|
||||
editSave: styleManager.editSave,
|
||||
styleExists: styleManager.styleExists,
|
||||
getStyle: styleManager.get,
|
||||
|
||||
getTabUrlPrefix() {
|
||||
return this.sender.tab.url.match(/^([\w-]+:\/+[^/#]+)/)[1];
|
||||
},
|
||||
|
||||
getStyleFromDB: id =>
|
||||
db.exec('get', id).then(event => event.target.result),
|
||||
|
||||
download(msg) {
|
||||
delete msg.method;
|
||||
return download(msg.url, msg);
|
||||
|
|
|
@ -328,7 +328,7 @@ function onRuntimeMessage(request) {
|
|||
// code-less style from notifyAllTabs
|
||||
const {sections, id} = request.style;
|
||||
((sections && sections[0] || {}).code === null
|
||||
? API.getStyleFromDB(id)
|
||||
? API.getStyle(id)
|
||||
: Promise.resolve([request.style])
|
||||
).then(([style]) => {
|
||||
editor.replaceStyle(style, request.codeIsUpdated);
|
||||
|
@ -418,7 +418,7 @@ function initStyleData() {
|
|||
|
||||
function fetchStyle() {
|
||||
if (id) {
|
||||
return API.getStyleFromDB(id);
|
||||
return API.getStyle(id);
|
||||
}
|
||||
return Promise.resolve(createEmptyStyle());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user