From 41ac66a1378b92ca3da1d5c189f678a31438ff9c Mon Sep 17 00:00:00 2001 From: eight Date: Tue, 25 Sep 2018 21:09:40 +0800 Subject: [PATCH] Add: background worker --- background/background.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/background/background.js b/background/background.js index 20033b52..ac530f57 100644 --- a/background/background.js +++ b/background/background.js @@ -4,11 +4,14 @@ global handleCssTransitionBug detectSloppyRegexps global openEditor global styleViaAPI global loadScript -global usercss +global usercss workerUtil */ 'use strict'; -var backgroundWorker = workerUtil.createWorker('/background/background-worker.js'); +// eslint-disable-next-line no-var +var backgroundWorker = workerUtil.createWorker({ + url: '/background/background-worker.js' +}); window.API_METHODS = Object.assign(window.API_METHODS || {}, { @@ -21,7 +24,7 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, { return download(msg.url, msg); }, parseCss({code}) { - return usercss.invokeWorker({action: 'parse', code}); + return backgroundWorker.parseMozFormat({code}); }, getPrefs: prefs.getAll, healthCheck: () => dbExec().then(() => true),