2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
8 YUI.add('queue-promote', function (Y, NAME) {
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)[0]);
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.13.0', {"requires": ["yui-base"]});