1 /* Licensed to the Apache Software Foundation (ASF) under one or more
  2  * contributor license agreements.  See the NOTICE file distributed with
  3  * this work for additional information regarding copyright ownership.
  4  * The ASF licenses this file to you under the Apache License, Version 2.0
  5  * (the "License"); you may not use this file except in compliance with
  6  * the License.  You may obtain a copy of the License at
  7  *
  8  *      http://www.apache.org/licenses/LICENSE-2.0
  9  *
 10  * Unless required by applicable law or agreed to in writing, software
 11  * distributed under the License is distributed on an "AS IS" BASIS,
 12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  * See the License for the specific language governing permissions and
 14  * limitations under the License.
 15  */
 16 /** @namespace myfaces._impl.xhrCore._AjaxRequestQueue */
 17 _MF_CLS(_PFX_XHR + "_AjaxRequestQueue", myfaces._impl._util._Queue, /** @lends  myfaces._impl.xhrCore._AjaxRequestQueue.prototype */ {
 18 
 19     /**
 20      * a pointer towards the currently processed
 21      * request in our queue
 22      */
 23     _curReq : null,
 24 
 25     /**
 26      * delay request, then call enqueue
 27      * @param {Object} request (myfaces._impl.xhrCore._AjaxRequest) request to send
 28      */
 29     enqueue : function(request) {
 30 
 31         if (this._curReq == null) {
 32             this._curReq = request;
 33             this._curReq.send();
 34         } else {
 35             this._callSuper("enqueue", request);
 36             if (request._queueSize != this._size) {
 37                 this.setQueueSize(request._queueSize);
 38             }
 39         }
 40 
 41     },
 42 
 43     /**
 44      * process queue, send request, if exists
 45      */
 46     processQueue: function() {
 47         this._curReq = this.dequeue();
 48         if (this._curReq) {
 49             this._curReq.send();
 50         }
 51     },
 52 
 53     /**
 54      * cleanup queue
 55      */
 56     cleanup: function() {
 57         this._curReq = null;
 58         this._callSuper("cleanup");
 59     }
 60 });
 61 
 62