2 Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.com/yui/license.html
8 YUI.add('queue-promote', function(Y) {
11 * Adds methods promote, remove, and indexOf to Queue instances.
13 * @module queue-promote
17 Y.mix(Y.Queue.prototype, {
19 * Returns the current index in the queue of the specified item
22 * @param needle {MIXED} the item to search for
23 * @return {Number} the index of the item or -1 if not found
25 indexOf : function (callback) {
26 return Y.Array.indexOf(this._q, callback);
30 * Moves the referenced item to the head of the queue
33 * @param item {MIXED} an item in the queue
35 promote : function (callback) {
36 var index = this.indexOf(callback);
39 this._q.unshift(this._q.splice(index,1));
44 * Removes the referenced item from the queue
47 * @param item {MIXED} an item in the queue
49 remove : function (callback) {
50 var index = this.indexOf(callback);
53 this._q.splice(index,1);
60 }, '3.3.0' ,{requires:['yui-base']});