From 29d1e7212d06b805ed898c57b3ffae5411c6eea6 Mon Sep 17 00:00:00 2001 From: Dominik Reh Date: Sun, 29 Jan 2023 16:40:04 +0100 Subject: [PATCH] Rename queues to fit const naming convention --- javascript/__globals.js | 8 ++++---- javascript/_utils.js | 2 +- javascript/tagAutocomplete.js | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/javascript/__globals.js b/javascript/__globals.js index cc918f2..dacc065 100644 --- a/javascript/__globals.js +++ b/javascript/__globals.js @@ -39,9 +39,9 @@ var umiPreviousTags = []; /// Similar to a callback system, but primitive. // Queues -const afterInsertQueue = []; -const afterSetupQueue = []; -const afterConfigChangeQueue = []; +const QUEUE_AFTER_INSERT = []; +const QUEUE_AFTER_SETUP = []; +const QUEUE_AFTER_CONFIG_CHANGE = []; // List of parsers to try -const parsers = []; \ No newline at end of file +const PARSERS = []; \ No newline at end of file diff --git a/javascript/_utils.js b/javascript/_utils.js index 08ba55d..be54860 100644 --- a/javascript/_utils.js +++ b/javascript/_utils.js @@ -113,7 +113,7 @@ async function processQueueReturn(queue, context, ...args) // Specific to tag completion parsers async function processParsers(textArea, prompt) { // Get all parsers that have a successful trigger condition - let matchingParsers = parsers.filter(parser => parser.triggerCondition()); + let matchingParsers = PARSERS.filter(parser => parser.triggerCondition()); // Guard condition if (matchingParsers.length === 0) { return null; diff --git a/javascript/tagAutocomplete.js b/javascript/tagAutocomplete.js index 7efd0cb..22c98e8 100644 --- a/javascript/tagAutocomplete.js +++ b/javascript/tagAutocomplete.js @@ -226,7 +226,7 @@ async function syncOptions() { CFG = newCFG; // Callback - processQueue(afterConfigChangeQueue, null); + processQueue(QUEUE_AFTER_CONFIG_CHANGE, null); } // Create the result list div and necessary styling @@ -362,7 +362,7 @@ function insertTextAtCursor(textArea, result, tagword) { previousTags = tags; // Callback - processQueue(afterInsertQueue, null, tagType); + processQueue(QUEUE_AFTER_INSERT, null, tagType); // If it was a yaml wildcard, also update the umiPreviousTags if (tagType === ResultType.yamlWildcard && originalTagword.length > 0) { @@ -1266,7 +1266,7 @@ async function setup() { gradioApp().appendChild(acStyle); // Callback - processQueue(afterSetupQueue, null); + processQueue(QUEUE_AFTER_SETUP, null); } onUiUpdate(async () => {