timing/Serializer.js
/**
		 * 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.
		 */
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.
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 .
enqueue(actionToEnqueue) {
			return promise.build((resolveCallback, rejectCallback) => {
				assert.argumentIsRequired(actionToEnqueue, 'actionToEnqueue', Function);
				if (this.getIsDisposed()) {
					throw new Error('Unable to add action to the Serializer, it has been disposed.');
				}
				this._enqueued = this._enqueued + 1;
				this._getWorkQueue().enqueue(() => {
					return Promise.resolve()
						.then(() => {
							if (this.getIsDisposed()) {
								throw new Error('Unable to process Serializer action, the serializer has been disposed.');
							}
							this._processed = this._processed + 1;
							return actionToEnqueue();
						}).then((result) => {
							resolveCallback(result);
						}).catch((error) => {
							rejectCallback(error);
						});
				});
				checkStart.call(this);
			});
		}
enqueue ( actionToEnqueue ) { return promise . build ( ( resolveCallback , rejectCallback ) => { assert . argumentIsRequired ( actionToEnqueue , 'actionToEnqueue' , Function ) ; if ( this . getIsDisposed ( ) ) { throw new Error ( 'Unable to add action to the Serializer, it has been disposed.' ) ; } this . _enqueued = this . _enqueued + 1 ; this . _getWorkQueue ( ) . enqueue ( ( ) => { return Promise . resolve ( ) . then ( ( ) => { if ( this . getIsDisposed ( ) ) { throw new Error ( 'Unable to process Serializer action, the serializer has been disposed.' ) ; } this . _processed = this . _processed + 1 ; return actionToEnqueue ( ) ; } ) . then ( ( result ) => { resolveCallback ( result ) ; } ) . catch ( ( error ) => { rejectCallback ( error ) ; } ) ; } ) ; checkStart . call ( this ) ; } ) ; }
Adds a new action to the processing queue.
Adds a new action to the processing queue .