Fix: use cacheFirstCall

This commit is contained in:
eight 2018-09-01 21:29:31 +08:00
parent 525498ea9a
commit e3316aa811

View File

@ -1,9 +1,14 @@
/* global showHelp editorWorker */
/* global showHelp editorWorker cacheFirstCall */
'use strict';
function createLinterHelpDialog(getIssues) {
let csslintRules;
let preparing;
const prepareCsslintRules = cacheFirstCall(() =>
editorWorker.getCsslintRules()
.then(rules => {
csslintRules = rules;
})
);
return {show};
function show() {
@ -43,14 +48,4 @@ function createLinterHelpDialog(getIssues) {
)
);
}
function prepareCsslintRules() {
if (!preparing) {
preparing = editorWorker.getCsslintRules()
.then(rules => {
csslintRules = rules;
});
}
return preparing;
}
}