Fix: don't compose but extend

This commit is contained in:
eight 2018-09-02 15:03:15 +08:00
parent f4dca505fb
commit 2efc2d8dd2
2 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@
'use strict'; 'use strict';
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
var linterReport = (() => { Object.assign(linter, (() => {
const cms = new Map(); const cms = new Map();
const helpDialog = createLinterHelpDialog(getIssues); const helpDialog = createLinterHelpDialog(getIssues);
@ -37,7 +37,7 @@ var linterReport = (() => {
updateCount(); updateCount();
}); });
return {refresh}; return {refreshReport};
function updateCount() { function updateCount() {
const issueCount = Array.from(cms.values()) const issueCount = Array.from(cms.values())
@ -66,7 +66,7 @@ var linterReport = (() => {
} }
} }
function refresh() { function refreshReport() {
for (const table of cms.values()) { for (const table of cms.values()) {
table.updateCaption(); table.updateCaption();
} }
@ -162,4 +162,4 @@ var linterReport = (() => {
cm.focus(); cm.focus();
cm.setSelection(anno.from); cm.setSelection(anno.from);
} }
})(); })());

View File

@ -5,7 +5,7 @@ global onChange initHooks setCleanGlobal
global fromMozillaFormat maximizeCodeHeight toggleContextMenuDelete global fromMozillaFormat maximizeCodeHeight toggleContextMenuDelete
global setCleanItem updateTitle global setCleanItem updateTitle
global showAppliesToHelp beautify regExpTester setGlobalProgress setCleanSection global showAppliesToHelp beautify regExpTester setGlobalProgress setCleanSection
global clipString linter linterReport global clipString linter
*/ */
'use strict'; 'use strict';
@ -152,7 +152,7 @@ function addSection(event, section) {
cm = setupCodeMirror(div, code); cm = setupCodeMirror(div, code);
} }
linter.enableForEditor(cm); linter.enableForEditor(cm);
linterReport.refresh(); linter.refreshReport();
div.CodeMirror = cm; div.CodeMirror = cm;
setCleanSection(div); setCleanSection(div);
return div; return div;
@ -482,7 +482,7 @@ function removeSection(event) {
updateTitle(); updateTitle();
cm.focus(); cm.focus();
linter.enableForEditor(cm); linter.enableForEditor(cm);
linterReport.refresh(); linter.refreshReport();
}; };
section.insertAdjacentElement('afterend', stub); section.insertAdjacentElement('afterend', stub);
} }
@ -490,7 +490,7 @@ function removeSection(event) {
removeAreaAndSetDirty(section); removeAreaAndSetDirty(section);
editors.splice(editors.indexOf(cm), 1); editors.splice(editors.indexOf(cm), 1);
linter.disableForEditor(cm); linter.disableForEditor(cm);
linterReport.refresh(); linter.refreshReport();
} }
function removeAreaAndSetDirty(area) { function removeAreaAndSetDirty(area) {