diff --git a/background/background.js b/background/background.js index b5e803eb..4e66bf11 100644 --- a/background/background.js +++ b/background/background.js @@ -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); diff --git a/edit/edit.js b/edit/edit.js index 42fa5980..253d12ab 100644 --- a/edit/edit.js +++ b/edit/edit.js @@ -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()); }