Sha256: 00292c77acddd3b7779c922fb3857ee8c3d582cb50dcfee7fa7b99e66da8ab23
Contents?: true
Size: 1.49 KB
Versions: 10
Compression:
Stored size: 1.49 KB
Contents
/** * An internal Queue class. * @private */ Ext.define('Ext.util.Queue', { constructor: function() { this.clear(); }, add : function(obj) { var me = this, key = me.getKey(obj); if (!me.map[key]) { ++me.length; me.items.push(obj); me.map[key] = obj; } return obj; }, /** * Removes all items from the collection. */ clear : function(){ var me = this, items = me.items; me.items = []; me.map = {}; me.length = 0; return items; }, contains: function (obj) { var key = this.getKey(obj); return this.map.hasOwnProperty(key); }, /** * Returns the number of items in the collection. * @return {Number} the number of items in the collection. */ getCount : function(){ return this.length; }, getKey : function(obj){ return obj.id; }, /** * Remove an item from the collection. * @param {Object} obj The item to remove. * @return {Object} The item removed or false if no item was removed. */ remove : function(obj){ var me = this, key = me.getKey(obj), items = me.items, index; if (me.map[key]) { index = Ext.Array.indexOf(items, obj); Ext.Array.erase(items, index, 1); delete me.map[key]; --me.length; } return obj; } });
Version data entries
10 entries across 10 versions & 2 rubygems