diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui3.0.0/api/queue-base.js.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui3.0.0/api/queue-base.js.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,227 @@ + + +
+ +/**
+ * The YUI module contains the components required for building the YUI seed file.
+ * This includes the script loading mechanism, a simple queue, and the core utilities for the library.
+ * @module yui
+ * @submodule yui-base
+ */
+
+/**
+ * A simple FIFO queue. Items are added to the Queue with add(1..n items) and
+ * removed using next().
+ *
+ * @class Queue
+ * @param item* {MIXED} 0..n items to seed the queue
+ */
+function Queue() {
+ this._init();
+ this.add.apply(this, arguments);
+}
+
+Queue.prototype = {
+ /**
+ * Initialize the queue
+ *
+ * @method _init
+ * @protected
+ */
+ _init : function () {
+ /**
+ * The collection of enqueued items
+ *
+ * @property _q
+ * @type {Array}
+ * @protected
+ */
+ this._q = [];
+ },
+
+ /**
+ * Get the next item in the queue.
+ *
+ * @method next
+ * @return {MIXED} the next item in the queue
+ */
+ next : function () {
+ return this._q.shift();
+ },
+
+ /**
+ * Add 0..n items to the end of the queue
+ *
+ * @method add
+ * @param item* {MIXED} 0..n items
+ */
+ add : function () {
+ Y.Array.each(Y.Array(arguments,0,true),function (fn) {
+ this._q.push(fn);
+ },this);
+
+ return this;
+ },
+
+ /**
+ * Returns the current number of queued items
+ *
+ * @method size
+ * @return {Number}
+ */
+ size : function () {
+ return this._q.length;
+ }
+};
+
+Y.Queue = Queue;
+