Skip to content

Commit 727cd0c

Browse files
committed
adjustBuffer counters
1 parent be09ec0 commit 727cd0c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

demo/examples/scopeDatasource.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
</head>
1111
<body ng-controller="mainController">
1212

13-
<h2 style="position: fixed; left: 150px; top: 0;">is loading: {{loading}}; &nbsp; &nbsp; &nbsp; <a href="../index.html"> browse sample code</a></h2>
13+
<h2 style="position: fixed; left: 150px; top: 0;">is loading: {{loading}}; &nbsp; &nbsp; &nbsp; <a href="../index.html"> browse sample code</a><br/>counters: ab {{adapter.abCount}} abf {{adapter.abfCount}} s {{adapter.sCount}}</h2>
1414

1515
<div ui-scroll-viewport style="width: 340px; height: 300px; display: block; background-color: white;">
1616
<ul>
17-
<li ui-scroll="item in datasource" is-loading="loading">*{{item}}*</li>
17+
<li ui-scroll="item in datasource" adapter="adapter" is-loading="loading">*{{item}}*</li>
1818
</ul>
1919
</div>
2020

src/ui-scroll.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,10 @@ angular.module('ui.scroll', [])
610610
viewport.resetTopPaddingHeight();
611611
viewport.resetBottomPaddingHeight();
612612

613+
adapter.abCount = 0;
614+
adapter.abfCount = 0;
615+
adapter.sCount = 0;
616+
613617
if (arguments.length) {
614618
buffer.clear(arguments[0]);
615619
} else {
@@ -725,6 +729,7 @@ angular.module('ui.scroll', [])
725729
function adjustBuffer(rid) {
726730
// We need the item bindings to be processed before we can do adjustment
727731
return $timeout(() => {
732+
adapter.abCount++;
728733
processBufferedItems(rid);
729734

730735
if (viewport.shouldLoadBottom()) {
@@ -742,6 +747,7 @@ angular.module('ui.scroll', [])
742747
function adjustBufferAfterFetch(rid) {
743748
// We need the item bindings to be processed before we can do adjustment
744749
return $timeout(() => {
750+
adapter.abfCount++;
745751
let keepFetching = processBufferedItems(rid);
746752

747753
if (viewport.shouldLoadBottom() && keepFetching) {
@@ -821,6 +827,7 @@ angular.module('ui.scroll', [])
821827

822828
function resizeAndScrollHandler() {
823829
if (!$rootScope.$$phase && !adapter.isLoading) {
830+
adapter.sCount++;
824831
adjustBuffer();
825832
}
826833
}

0 commit comments

Comments
 (0)