Reputation: 691
Building an Ionic app and have suddenly come across an issue that I am finding really difficult to debug where the browser is 'deferring' long running timer tasks causing my views to execute the code in their controllers only once (even when the controller is explicitly reloaded).
Warning is:
Deferred long-running timer task(s) to improve scrolling smoothness. See crbug.com/574343.
What I'm after:
Thanks in advance.
Update I felt it was important to note that while never receiving errors and only warnings as the cause for my problems, I have since rolled back to a working version.
This working version still has warnings appearing but does not affect the running of my application.
Upvotes: 43
Views: 10010
Reputation:
Sounds like you may have max number of connections in your browser. You may want to decrease your http requests to a single request that contains something which would be 10 requests vs 10 separate http requests.
The answer in regards to your question is something along the lines of maximum http request per browser.
"Max Number of default simultaneous persistent connections per server/proxy:"
Also answered here if I am correctly assuming - Max parallel http connections in a browser?
Upvotes: 1
Reputation: 1085
well in case when you are doing tasks using $timeout , you have got to stop and destroy them else they would create the error you stated
for eg:
var timer = $timeout(
function() {
console.log( "Timeout executed", Date.now() );
},
2000
);
if you start a timeout as above then you got to destroy the timer as follows :
// When the DOM element is removed from the page,
// AngularJS will trigger the $destroy event on
// the scope. This gives us a chance to cancel any
// pending timer that we may have.
$scope.$on(
"$destroy",
function( event ) {
$timeout.cancel( timer );
}
);
Upvotes: 6
Reputation: 11
I faced this issue when function was called only first time the view was loaded. Noticed this warning in the console but not sure if this is related to function getting called only once. In the controller, I moved my function call inside "$ionicView.enter" and it gets called every time view is loaded.
$scope.$on('$ionicView.enter', function () {
callMyFunction();
});
Hope this helps.
Upvotes: 1