]>
git.proxmox.com Git - extjs.git/blob - extjs/packages/core/src/app/route/Queue.js
2 * A Queue is a queue of {@link Ext.app.route.Route} instances managed by the
3 * {@link Ext.app.route.Router} singleton if queueActions is set to `true`.
5 * A developer shouldn't need to use this class as {@link Ext.app.route.Router} should
6 * manage this class. When a {@link Ext.app.route.Route} is executed,it will automatically
7 * keep running the queue until the queue is empty.
10 Ext
.define('Ext.app.route.Queue', {
12 * The {@link Ext.util.MixedCollection} that will hold the queued
13 * {@link Ext.app.route.Route} and recognized arguments.
20 * The token from the {@link Ext.app.route.Router} that is being enacted on.
24 constructor : function(config
) {
25 Ext
.apply(this, config
);
27 //Create the queue MixedCollection
28 this.queue
= new Ext
.util
.MixedCollection();
32 * Add a {@link Ext.app.route.Route} to the queue.
34 * @param {Ext.app.route.Route} route The route to add to the queue.
35 * @param {Object} args The arguments recognized by the {Ext.app.route.Route}.
37 queueAction : function (route
, args
) {
45 * Clear all queued actions.
47 clearQueue : function() {
48 this.queue
.removeAll();
52 * Run the queue one by one.
54 runQueue : function() {
55 var queue
= this.queue
,
56 action
= queue
.removeAt(0),
60 route
= action
&& action
.route
;
62 route
.execute(this.token
, action
.args
, this.onActionExecute
, this);
67 * Handle the execution of a queued action and optionally clear all queued actions.
69 * @param {Boolean} clearQueue If `true` was returned, will clear all queued actions.
71 onActionExecute : function(clearQueue
) {
73 //clear all queued actions
76 //continue with queue execution