diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui_3.0.0b1/api/queue-promote.js.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui_3.0.0b1/api/queue-promote.js.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,185 @@ + + +
+ +/**
+ * Adds methods promote, remove, and indexOf to Queue instances.
+ *
+ * @module queue
+ * @submodule queue-promote
+ * @for Queue
+ */
+
+Y.mix(Y.Queue.prototype, {
+ /**
+ * Returns the current index in the queue of the specified item
+ *
+ * @method indexOf
+ * @param needle {MIXED} the item to search for
+ * @return {Number} the index of the item or -1 if not found
+ */
+ indexOf : function (callback) {
+ return Y.Array.indexOf(this._q, callback);
+ },
+
+ /**
+ * Moves the referenced item to the head of the queue
+ *
+ * @method promote
+ * @param item {MIXED} an item in the queue
+ */
+ promote : function (callback) {
+ var index = this.indexOf(callback);
+
+ if (index > -1) {
+ this._q.unshift(this._q.splice(index,1));
+ }
+ },
+
+ /**
+ * Removes the referenced item from the queue
+ *
+ * @method remove
+ * @param item {MIXED} an item in the queue
+ */
+ remove : function (callback) {
+ var index = this.indexOf(callback);
+
+ if (index > -1) {
+ this._q.splice(index,1);
+ }
+ }
+
+});
+