Closed dikaso closed 8 years ago
Thanks, @DinkoMiletic. This seems like a nice little improvement. Do you have any example (and code) of how you would use this that I can include in the documentation too?
Sure. Give me few days and I'll put it here.
Great. I'm looking forward to it.
Passing invokeApply as false will skip angular model dirty checking on every run of asyncRefreshDelay or refreshInterval. This can result in huge performance gain if refreshInterval is set to really low value (e.g. 500ms).
iScrollServiceProvider.configureDefaults({
iscroll: {
invokeApply:false
}
});
Let's test it. Past this code to your app run block:
/**
* this code is for measuring performances
* logs digest time in console
*/
var $oldDigest = $rootScope.$digest;
var $newDigest = function() {
console.time("$digest");
$oldDigest.apply($rootScope);
console.timeEnd("$digest");
};
$rootScope.$digest = $newDigest;
invokeApply:true
and refreshInterval:500
you'll see that digest is run every 500msinvokeApply:false
and refreshInterval:500
you'll see that digest is not invoked by angular-iScrollAgain, thank you for your contributions @DinkoMiletic. I've now finally incorporated your documentation too, and I've made invokeApply = false
the new default.
Hey,
This is is a small optimization/option to skip dirty checking on refresh. If you have a lot of bindings refresh will cause huge performance loses.
Let me know if something is wrong.