5 elgg.ElggPriorityList =
function() {
18 elgg.ElggPriorityList.prototype.insert =
function(obj, opt_priority) {
20 if (arguments.length == 2 && opt_priority !== undefined) {
21 priority = parseInt(opt_priority, 10);
24 priority = Math.max(priority, 0);
26 if (
elgg.isUndefined(
this.priorities_[priority])) {
27 this.priorities_[priority] = [];
30 this.priorities_[priority].push(obj);
43 elgg.ElggPriorityList.prototype.forEach =
function(callback) {
44 elgg.assertTypeOf(
'function', callback);
48 this.priorities_.forEach(
function(elems) {
49 elems.forEach(
function(elem) {
50 callback(elem, index++);
66 elgg.ElggPriorityList.prototype.every =
function(callback) {
67 elgg.assertTypeOf(
'function', callback);
71 return this.priorities_.every(
function(elems) {
72 return elems.every(
function(elem) {
73 return callback(elem, index++);
84 elgg.ElggPriorityList.prototype.remove =
function(obj) {
85 this.priorities_.forEach(
function(elems) {
87 while ((index = elems.indexOf(obj)) !== -1) {
88 elems.splice(index, 1);