Fix: use promise API
This commit is contained in:
parent
5d07a8cd4e
commit
a3e7915199
|
@ -40,14 +40,13 @@
|
|||
if (style.usercssData) {
|
||||
return Promise.resolve(style);
|
||||
}
|
||||
try {
|
||||
const {sourceCode} = style;
|
||||
|
||||
// allow sourceCode to be normalized
|
||||
const {sourceCode} = style;
|
||||
delete style.sourceCode;
|
||||
return Promise.resolve(Object.assign(usercss.buildMeta(sourceCode), style));
|
||||
} catch (e) {
|
||||
return Promise.reject(e);
|
||||
}
|
||||
|
||||
return usercss.buildMeta(sourceCode)
|
||||
.then(newStyle => Object.assign(newStyle, style));
|
||||
}
|
||||
|
||||
function assignVars(style) {
|
||||
|
@ -59,7 +58,8 @@
|
|||
style.id = dup.id;
|
||||
if (style.reason !== 'config') {
|
||||
// preserve style.vars during update
|
||||
usercss.assignVars(style, dup);
|
||||
return usercss.assignVars(style, dup)
|
||||
.then(() => style);
|
||||
}
|
||||
}
|
||||
return style;
|
||||
|
|
Loading…
Reference in New Issue
Block a user