Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 216a09c

Browse files
committedMar 7, 2016
Merge pull request #54 from aantipov/call-first-reload-with-timeout
Call first reload with $timeout
2 parents 00c67d3 + 18cb06b commit 216a09c

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed
 

‎demo/examples/positionedList.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ angular.module('application', [
88
'$rootScope',
99
'$location',
1010
function (console, $timeout, $rootScope, $location) {
11-
var current, data, get, i, j, k, l, len, len1, letter1, letter2, position, ref, ref1, revision;
11+
var current, data, get, i, j, k, l, len, len1, letter1, letter2, position, ref, ref1;
1212
$rootScope.key = "";
1313
position = 0;
1414
data = [];
@@ -50,12 +50,9 @@ angular.module('application', [
5050
}
5151
return current++;
5252
});
53-
revision = function () {
54-
return current;
55-
};
53+
5654
return {
57-
get: get,
58-
revision: revision
55+
get: get
5956
};
6057
}
6158
]);

‎src/ui-scroll.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ angular.module('ui.scroll', [])
9999
buffer.first = origin;
100100
buffer.next = origin;
101101
buffer.minIndex = Number.MAX_VALUE;
102-
return buffer.maxIndex = Number.MIN_VALUE;
102+
buffer.maxIndex = Number.MIN_VALUE;
103103
}
104104

105105
angular.extend(buffer, {
@@ -566,8 +566,6 @@ angular.module('ui.scroll', [])
566566
viewport.bind('scroll', resizeAndScrollHandler);
567567
viewport.bind('mousewheel', wheelHandler);
568568

569-
$scope.$watch(datasource.revision, () => reload());
570-
571569
$scope.$on('$destroy', () => {
572570
// clear the buffer. It is necessary to remove the elements and $destroy the scopes
573571
buffer.clear();
@@ -576,6 +574,25 @@ angular.module('ui.scroll', [])
576574
viewport.unbind('mousewheel', wheelHandler);
577575
});
578576

577+
// update events (deprecated since v1.1.0, unsupported since 1.2.0)
578+
(() => {
579+
const eventListener = datasource.scope ? datasource.scope.$new() : $scope.$new();
580+
581+
eventListener.$on('insert.item', () => unsupportedMethod('insert'));
582+
583+
eventListener.$on('update.items', () => unsupportedMethod('update'));
584+
585+
eventListener.$on('delete.items', () => unsupportedMethod('delete'));
586+
587+
function unsupportedMethod(token) {
588+
throw new Error(token + ' event is no longer supported - use applyUpdates instead');
589+
}
590+
})();
591+
592+
reload();
593+
594+
/* Functions definitions */
595+
579596
function dismissPendingRequests() {
580597
ridActual++;
581598
pending = [];
@@ -807,21 +824,6 @@ angular.module('ui.scroll', [])
807824
event.preventDefault();
808825
}
809826
}
810-
811-
// update events (deprecated since v1.1.0, unsupported since 1.2.0)
812-
(() => {
813-
const eventListener = datasource.scope ? datasource.scope.$new() : $scope.$new();
814-
815-
eventListener.$on('insert.item', () => unsupportedMethod('insert'));
816-
817-
eventListener.$on('update.items', () => unsupportedMethod('update'));
818-
819-
eventListener.$on('delete.items', () => unsupportedMethod('delete'));
820-
821-
function unsupportedMethod(token) {
822-
throw new Error(token + ' event is no longer supported - use applyUpdates instead');
823-
}
824-
})();
825827
};
826828
}
827829
}

0 commit comments

Comments
 (0)
Please sign in to comment.