I have a Cordova/AngularJS/Firebase app that makes use of angular fire library.
I am trying to fix some performance issues, mostly on the "resume" function when the app is re-opened from the background it appears to freeze for a couple seconds.
My profiling remotely in safari shows that several "timer installed" and "timer removed" are being called, as many as 50 in a row. During this process the app is frozen, can anybody point me in a direction to try and fix this? Do I need to be disposing of some resource? Angular fire documentation says that all watches are destroyed when the controller scope that contains them is destroyed. How can I further debug this to find out what is going on?
I have several services classes that follow a pattern like this for opening connections:
(function () {
angular.module('myApp').service('someService',
['$firebaseObject',
'$firebaseArray',
'$rootScope',
function ($firebaseObject, $firebaseArray, $rootScope) {
this.dbUsers = firebase.database().ref('users');
this.dbNotifications = firebase.database().ref('notifications');
this.dbMessages = firebase.database().ref('messages');
}]);//fireService
})();
Should I be disposing of these connections or closing them somehow? My controllers access these services frequently, all which open connections in the beginning like this example