Load lines before nicklist
Nicklist is not nearly as important as the actual lines, load them first for better perceived performance. Parsing the nicklist can take a noticeable amount of time for channels with thousands of occupants. This also improves/fixes the nicklist emptiness check
This commit is contained in:
parent
ac548777fc
commit
730c7dab8d
2 changed files with 28 additions and 12 deletions
17
js/models.js
17
js/models.js
|
@ -147,13 +147,25 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
// Check if the nicklist is empty, i.e., no nicks present
|
||||
// This checks for the presence of people, not whether a
|
||||
// request for the nicklist has been made
|
||||
var isNicklistEmpty = function() {
|
||||
for (var obj in nicklist) {
|
||||
return false;
|
||||
if (obj !== 'root') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
var nicklistRequested = function() {
|
||||
// If the nicklist has been requested but is empty, it
|
||||
// still has a 'root' property. Check for its existence.
|
||||
return nicklist.hasOwnProperty('root');
|
||||
};
|
||||
|
||||
return {
|
||||
id: pointer,
|
||||
fullName: fullName,
|
||||
|
@ -179,7 +191,8 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
|||
addToHistory: addToHistory,
|
||||
getHistoryUp: getHistoryUp,
|
||||
getHistoryDown: getHistoryDown,
|
||||
isNicklistEmpty: isNicklistEmpty
|
||||
isNicklistEmpty: isNicklistEmpty,
|
||||
nicklistRequested: nicklistRequested
|
||||
};
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue