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