Skip to content

Commit

Permalink
BREAKING(Queue): rename Queue to FunctionQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaaz committed Feb 20, 2020
1 parent b4d98d8 commit 95c586c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion esmExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export { default as Prompt } from './src/Utility/Discord/Prompt';
export { default as MessageCollector } from './src/Utility/Discord/MessageCollector';
export { default as ReactionCollector } from './src/Utility/Discord/ReactionCollector';
// External
export { default as Queue } from './src/Utility/External/Queue';
export { default as FunctionQueue } from './src/Utility/External/FunctionQueue';
export { default as AutoQueue } from './src/Utility/External/AutoQueue';
export { default as AsyncQueue } from './src/Utility/External/AsyncQueue';
export { default as LRUCache } from './src/Utility/External/LRUCache';
Expand Down
2 changes: 1 addition & 1 deletion examples/djs/src/modules/Private/commands/Eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Embed,
Prompt,
MessageCollector,
Queue,
FunctionQueue,
AutoQueue,
AsyncQueue,
} from 'axoncore';
Expand Down
2 changes: 1 addition & 1 deletion examples/eris/src/modules/Private/commands/Eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Embed,
Prompt,
MessageCollector,
Queue,
FunctionQueue,
AutoQueue,
AsyncQueue,
} from 'axoncore';
Expand Down
6 changes: 3 additions & 3 deletions src/Utility/External/AsyncQueue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Queue from './Queue';
import FunctionQueue from './FunctionQueue';

/**
* This data structure is a queue that will run every function one by one sequentially.
Expand All @@ -10,9 +10,9 @@ import Queue from './Queue';
* @author KhaaZ
*
* @class AsyncQueue
* @extends Queue
* @extends FunctionQueue
*/
class AsyncQueue extends Queue {
class AsyncQueue extends FunctionQueue {
/**
* Execute the queue.
* @memberof AsyncQueue
Expand Down
6 changes: 3 additions & 3 deletions src/Utility/External/AutoQueue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Queue from './Queue';
import FunctionQueue from './FunctionQueue';

/**
* This data structure is a queue that will run every function one by one sequentially.
Expand All @@ -10,9 +10,9 @@ import Queue from './Queue';
* @KhaaZ
*
* @class AutoQueue
* @extends Queue
* @extends FunctionQueue
*/
class AutoQueue extends Queue {
class AutoQueue extends FunctionQueue {
/**
* Execute the queue.
* @memberof AutoQueue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* This default Queue works in a synchronous fashion.
* This default FunctionQueue works in a synchronous fashion.
* It will execute all synchronous functions sequentially.
* Any error will be caught and unless specified otherwise won't break the queue execution.
* The queue can be auto executed on add or the execution can be delayed.
* Any error will be caught and unless specified otherwise won't break the FunctionQueue execution.
* The FunctionQueue can be auto executed on add or the execution can be delayed.
*
* @author KhaaZ
*
* @class Queue
* @class FunctionQueue
*
* @prop {Boolean} [stopOnError=false] Whether to stop the queue execution on error.

This comment has been minimized.

Copy link
@bsian03

bsian03 Feb 23, 2020

Contributor

queue => FunctionQueue for consistency?

This comment has been minimized.

Copy link
@Khaaz

Khaaz Feb 24, 2020

Author Owner

Nice catch will edit

This comment has been minimized.

Copy link
@Khaaz

Khaaz Feb 24, 2020

Author Owner

fixed in c17663f

*/
class Queue {
class FunctionQueue {
/**
* Creates an instance of Queue.
* Creates an instance of FunctionQueue.
*
* @param {Boolean} [stopOnError=false]
* @memberof Queue
* @memberof FunctionQueue
*/
constructor(stopOnError = false) {
/**
Expand All @@ -28,8 +28,8 @@ class Queue {
}

/**
* Execute the Queue
* @memberof Queue
* Execute the FunctionQueue
* @memberof FunctionQueue
*/
exec() {
if (this._functions.length > 0) {
Expand All @@ -52,13 +52,13 @@ class Queue {
}

/**
* Adds a function to the queue.
* Adds a function to the FunctionQueue.
* Automatically will wrap the function in a closure to keep the function context.
*
* @param {Function} func - The function to run
* @param {Boolean} [toExec=true] - Whether to auto exec the queue on add or not.
* @param {Boolean} [toExec=true] - Whether to auto exec the FunctionQueue on add or not.
* @param {...any} args - All arguments the function needs
* @memberof Queue
* @memberof FunctionQueue
*/
add(func, toExec = true, ...args) {
const fn = this.createClosure(func, ...args);
Expand All @@ -80,4 +80,4 @@ class Queue {
}
}

export default Queue;
export default FunctionQueue;

0 comments on commit 95c586c

Please sign in to comment.