Skip to content

Commit

Permalink
Renamed listen to observe.
Browse files Browse the repository at this point in the history
  • Loading branch information
oblador committed Oct 6, 2013
1 parent ee24630 commit f2d2bf3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Usage
```js
angular.module('myApp', ['duScroll']).
controller('myCtrl', function($scope, scrollPosition){
scrollPosition.listen(function(scrollY) {
scrollPosition.observe(function(scrollY) {
console.log('Scrolled to ', scrollY);
});
}
Expand Down
10 changes: 5 additions & 5 deletions angular-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ factory('requestAnimation', function($window, $timeout) {
angular.module('duScroll.scrollPosition', ['duScroll.requestAnimation']).
factory('scrollPosition',
function($window, requestAnimation) {
var listeners = [];
var observers = [];
var lastScrollY = 0;
var currentScrollY = 0;

var executeCallbacks = function(scrollY){
currentScrollY = lastScrollY;
for(var i = 0; i < listeners.length; i++){
listeners[i](currentScrollY);
for(var i = 0; i < observers.length; i++){
observers[i](currentScrollY);
}
};

Expand All @@ -36,8 +36,8 @@ factory('scrollPosition',
});

return {
listen : function(cb){
listeners.push(cb);
observe : function(cb){
observers.push(cb);
}
};
});
Expand Down
2 changes: 1 addition & 1 deletion angular-scroll.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion angular-scroll.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/services/scroll-position.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
angular.module('duScroll.scrollPosition', ['duScroll.requestAnimation']).
factory('scrollPosition',
function($window, requestAnimation) {
var listeners = [];
var observers = [];
var lastScrollY = 0;
var currentScrollY = 0;

var executeCallbacks = function(scrollY){
currentScrollY = lastScrollY;
for(var i = 0; i < listeners.length; i++){
listeners[i](currentScrollY);
for(var i = 0; i < observers.length; i++){
observers[i](currentScrollY);
}
};

Expand All @@ -21,8 +21,8 @@ factory('scrollPosition',
});

return {
listen : function(cb){
listeners.push(cb);
observe : function(cb){
observers.push(cb);
}
};
});

0 comments on commit f2d2bf3

Please sign in to comment.