UNPKG

@barchart/common-js

Version:
56 lines (55 loc) 1.45 kB
/** * A work queue that processes actions in sequence. * * @public * @extends {Disposable} */ export default class Serializer extends Disposable { /** * Gets the sequence of the item that was last processed. * * @public * @returns {number} */ public getCurrent(): number; /** * The total number of items that have been added to the queue. * * @public * @returns {number} */ public getTotal(): number; /** * The number of items that are currently pending. * * @public * @returns {number} */ public getPending(): number; /** * Indicates if a work item is currently being processed. * * @public * @returns {boolean} */ public getRunning(): boolean; /** * Adds a new action to the processing queue. If the action * is asynchronous, the action should return a promise. * * @public * @param {Function} actionToEnqueue * @returns {Promise} - A promise which resolves once the action has been processed. */ public enqueue(actionToEnqueue: Function): Promise<any>; /** * Allows an inheriting class to override the internal {@link Queue} implementation. * * @protected * @returns {Queue|*} */ protected _getWorkQueue(): Queue | any; #private; } import Disposable from './../lang/Disposable.js'; import Queue from './../collections/Queue.js';