From f4dca505fb8771b651bd4861a4d1361f5ad06f31 Mon Sep 17 00:00:00 2001 From: eight Date: Sun, 2 Sep 2018 14:52:06 +0800 Subject: [PATCH] Fix: callbacks -> listeners --- edit/linter-meta.js | 6 +++--- edit/linter.js | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/edit/linter-meta.js b/edit/linter-meta.js index 08f7756d..4233c402 100644 --- a/edit/linter-meta.js +++ b/edit/linter-meta.js @@ -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) }; } diff --git a/edit/linter.js b/edit/linter.js index 06d556ee..eb243c87 100644 --- a/edit/linter.js +++ b/edit/linter.js @@ -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); } }