Don't ng-repeat function calls, they're expensive
See http://tech.small-improvements.com/2013/09/10/angularjs-performance-with-large-lists/
This commit is contained in:
parent
e7d7f39c95
commit
3ad76d2ff3
2 changed files with 7 additions and 4 deletions
|
@ -221,7 +221,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
|
|||
</div>
|
||||
<div bindonce id="bufferlines" class="monospace" ng-swipe-right="swipeSidebar()" ng-swipe-left="openNick()" ng-class="{'withnicklist': showNicklist, 'withsidebar': showSidebar}">
|
||||
<div id="nicklist" ng-show="showNicklist" ng-swipe-right="closeNick()" class="vertical-line-left">
|
||||
<ul class="nicklistgroup list-unstyled" ng-repeat="group in activeBuffer().nicklist">
|
||||
<ul class="nicklistgroup list-unstyled" ng-repeat="group in nicklist">
|
||||
<li ng-repeat="nick in group.nicks|orderBy:'name'" ng-click="openBuffer(nick.name)">
|
||||
<a ng-click="nickAction(nick)"><span bo-class="nick.prefixClasses" bo-text="nick.prefix"></span><span bo-class="nick.nameClasses" bo-text="nick.name"></span></a>
|
||||
</li>
|
||||
|
@ -236,7 +236,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
|
|||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody ng-repeat="bufferline in (bufferlines = activeBuffer().lines)">
|
||||
<tbody ng-repeat="bufferline in bufferlines">
|
||||
<tr class="bufferline">
|
||||
<td class="time">
|
||||
<span class="date" bo-class="{'repeated-time': bufferline.shortTime==bufferlines[$index-1].shortTime}">
|
||||
|
|
|
@ -654,6 +654,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
|
||||
$rootScope.$on('activeBufferChanged', function(event, unreadSum) {
|
||||
var ab = models.getActiveBuffer();
|
||||
$scope.bufferlines = ab.lines;
|
||||
$scope.nicklist = ab.nicklist;
|
||||
|
||||
if (ab.requestedLines < $scope.lines) {
|
||||
// buffer has not been loaded, but some lines may already be present if they arrived after we connected
|
||||
|
@ -719,14 +721,15 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
|
||||
$scope.buffers = models.model.buffers;
|
||||
|
||||
$scope.bufferlines = {};
|
||||
$scope.nicklist = {};
|
||||
|
||||
$scope.activeBuffer = models.getActiveBuffer;
|
||||
|
||||
$rootScope.waseverconnected = false;
|
||||
|
||||
$rootScope.models = models;
|
||||
|
||||
$rootScope.buffer = [];
|
||||
|
||||
$rootScope.iterCandidate = null;
|
||||
|
||||
$store.bind($scope, "host", "localhost");
|
||||
|
|
Loading…
Reference in a new issue