Fix: remove codeIsUpdated in styleman

This commit is contained in:
eight04 2021-12-07 12:36:59 +08:00
parent cc314b7be0
commit e820f5de4a

View File

@ -283,7 +283,7 @@ const styleMan = (() => {
async toggle(id, enabled) { async toggle(id, enabled) {
if (ready.then) await ready; if (ready.then) await ready;
const style = Object.assign({}, id2style(id), {enabled}); const style = Object.assign({}, id2style(id), {enabled});
await saveStyle(style, {reason: 'toggle', codeIsUpdated: false}); await saveStyle(style, {reason: 'toggle'});
return id; return id;
}, },
@ -302,7 +302,7 @@ const styleMan = (() => {
if (ready.then) await ready; if (ready.then) await ready;
const style = Object.assign({}, id2style(id)); const style = Object.assign({}, id2style(id));
style[prop] = value; style[prop] = value;
return saveStyle(style, {reason: 'config', codeIsUpdated: false}); return saveStyle(style, {reason: 'config'});
}, },
}; };
@ -396,7 +396,7 @@ const styleMan = (() => {
return saveStyle(style, {reason: 'config'}); return saveStyle(style, {reason: 'config'});
} }
function broadcastStyleUpdated(style, reason, method = 'styleUpdated', codeIsUpdated = true) { function broadcastStyleUpdated(style, reason, method = 'styleUpdated') {
const {id} = style; const {id} = style;
const data = id2data(id); const data = id2data(id);
const excluded = new Set(); const excluded = new Set();
@ -419,7 +419,6 @@ const styleMan = (() => {
return msg.broadcast({ return msg.broadcast({
method, method,
reason, reason,
codeIsUpdated,
style: { style: {
id, id,
md5Url: style.md5Url, md5Url: style.md5Url,
@ -459,7 +458,7 @@ const styleMan = (() => {
return handleSave(style, handlingOptions); return handleSave(style, handlingOptions);
} }
function handleSave(style, {reason, codeIsUpdated, broadcast = true}) { function handleSave(style, {reason, broadcast = true}) {
const data = id2data(style.id); const data = id2data(style.id);
const method = data ? 'styleUpdated' : 'styleAdded'; const method = data ? 'styleUpdated' : 'styleAdded';
if (!data) { if (!data) {
@ -467,7 +466,7 @@ const styleMan = (() => {
} else { } else {
data.style = style; data.style = style;
} }
if (broadcast) broadcastStyleUpdated(style, reason, method, codeIsUpdated); if (broadcast) broadcastStyleUpdated(style, reason, method);
return style; return style;
} }