Fix: callbacks -> listeners
This commit is contained in:
parent
00ef20c073
commit
f4dca505fb
|
@ -2,7 +2,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function createMetaCompiler(cm) {
|
function createMetaCompiler(cm) {
|
||||||
const updateCallbacks = [];
|
const updateListeners = [];
|
||||||
let meta = null;
|
let meta = null;
|
||||||
let metaIndex = null;
|
let metaIndex = null;
|
||||||
let cache = [];
|
let cache = [];
|
||||||
|
@ -21,7 +21,7 @@ function createMetaCompiler(cm) {
|
||||||
return API.parseUsercss({sourceCode: match[0], metaOnly: true})
|
return API.parseUsercss({sourceCode: match[0], metaOnly: true})
|
||||||
.then(result => result.usercssData)
|
.then(result => result.usercssData)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
for (const cb of updateCallbacks) {
|
for (const cb of updateListeners) {
|
||||||
cb(result);
|
cb(result);
|
||||||
}
|
}
|
||||||
meta = match[0];
|
meta = match[0];
|
||||||
|
@ -42,6 +42,6 @@ function createMetaCompiler(cm) {
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
onUpdated: cb => updateCallbacks.push(cb)
|
onUpdated: cb => updateListeners.push(cb)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
// eslint-disable-next-line no-var
|
// eslint-disable-next-line no-var
|
||||||
var linter = (() => {
|
var linter = (() => {
|
||||||
const changeCallbacks = [];
|
const changeListeners = [];
|
||||||
const unhookCallbacks = [];
|
const unhookListeners = [];
|
||||||
const linters = [];
|
const linters = [];
|
||||||
const cms = new Set();
|
const cms = new Set();
|
||||||
|
|
||||||
|
@ -17,15 +17,15 @@ var linter = (() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
function onUnhook(cb) {
|
function onUnhook(cb) {
|
||||||
unhookCallbacks.push(cb);
|
unhookListeners.push(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChange(cb) {
|
function onChange(cb) {
|
||||||
changeCallbacks.push(cb);
|
changeListeners.push(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUpdateLinting(...args) {
|
function onUpdateLinting(...args) {
|
||||||
for (const cb of changeCallbacks) {
|
for (const cb of changeListeners) {
|
||||||
cb(...args);
|
cb(...args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ var linter = (() => {
|
||||||
function disableForEditor(cm) {
|
function disableForEditor(cm) {
|
||||||
cm.setOption('lint', false);
|
cm.setOption('lint', false);
|
||||||
cms.delete(cm);
|
cms.delete(cm);
|
||||||
for (const cb of unhookCallbacks) {
|
for (const cb of unhookListeners) {
|
||||||
cb(cm);
|
cb(cm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user