From 1f72ebf40f838e11bcbe83fc4359fee744608db3 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Thu, 25 Jun 2015 19:25:26 +0000 Subject: [PATCH] replace setInterval by angular --- js/public/app.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/public/app.js b/js/public/app.js index 6eec50d..b67601f 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -34,8 +34,8 @@ function arrayUnique(arr) { return unq; } -app.controller('OcSmsController', ['$scope', '$timeout', - function ($scope, $timeout) { +app.controller('OcSmsController', ['$scope', '$interval', '$timeout', + function ($scope, $interval, $timeout) { $scope.buttons = [ {text: "Send"} ]; @@ -74,6 +74,9 @@ app.controller('OcSmsController', ['$scope', '$timeout', }); }; + $interval(refreshConversation, 10000); + $interval(checkNewMessages, 10000); + $timeout(function () { // Register real title g_originalTitle = document.title; @@ -100,8 +103,6 @@ app.controller('OcSmsController', ['$scope', '$timeout', }); fetchInitialSettings(); initDesktopNotifies(); - setInterval(refreshConversation, 10000); - setInterval(checkNewMessages, 10000); }); } ]);