10 // show the most idle item
12 if (list._idlePrev == list) return null;
13 return list._idlePrev;
18 // remove the most idle item from the list
19 function shift(list) {
20 var first = list._idlePrev;
24 exports.shift = shift;
27 // remove a item from its list
28 function remove(item) {
30 item._idleNext._idlePrev = item._idlePrev;
34 item._idlePrev._idleNext = item._idleNext;
37 item._idleNext = null;
38 item._idlePrev = null;
40 exports.remove = remove;
43 // remove a item from its list and place at the end.
44 function append(list, item) {
46 item._idleNext = list._idleNext;
47 list._idleNext._idlePrev = item;
48 item._idlePrev = list;
49 list._idleNext = item;
51 exports.append = append;
54 function isEmpty(list) {
55 return list._idleNext === list;
57 exports.isEmpty = isEmpty;