Skip to content

Commit

Permalink
Merge pull request #5043 from swalters/fix-throttle
Browse files Browse the repository at this point in the history
performance(core): add false flag to $timeout and $interval to prevent $apply
  • Loading branch information
swalters committed Jan 30, 2016
2 parents 6709846 + 4ba2820 commit e588d59
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/js/core/services/ui-grid-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (typeof Function.prototype.bind !== "function") {
};
}

function getStyles (elem) {
function getStyles (elem) {
var e = elem;
if (typeof(e.length) !== 'undefined' && e.length) {
e = elem[0];
Expand Down Expand Up @@ -1175,7 +1175,7 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
if (timeout) {
$timeout.cancel(timeout);
}
timeout = $timeout(later, wait);
timeout = $timeout(later, wait, false);
if (callNow) {
result = func.apply(context, args);
}
Expand Down Expand Up @@ -1225,7 +1225,7 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
function runFunc(endDate){
lastCall = +new Date();
func.apply(context, args);
$interval(function(){ queued = null; }, 0, 1);
$interval(function(){ queued = null; }, 0, 1, false);
}

return function(){
Expand All @@ -1238,7 +1238,7 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
runFunc();
}
else if (options.trailing){
queued = $interval(runFunc, wait - sinceLast, 1);
queued = $interval(runFunc, wait - sinceLast, 1, false);
}
}
};
Expand Down

0 comments on commit e588d59

Please sign in to comment.