Matteo Scandolo | 69adff8 | 2015-12-16 14:41:21 -0800 | [diff] [blame^] | 1 | 'use strict'; |
2 | |||||
3 | angular.module('autoscaling') | ||||
4 | .service('Autoscaling', function($http, $interval, $rootScope){ | ||||
5 | |||||
6 | const pollingFrequency = 1; | ||||
7 | var pollinginterval; | ||||
8 | |||||
9 | this.getAutoscalingData = () => { | ||||
10 | pollinginterval = $interval(() => { | ||||
11 | $http.get('/autoscaledata') | ||||
12 | .then((res) => { | ||||
13 | $rootScope.$emit('autoscaling.update', res.data); | ||||
14 | }); | ||||
15 | }, pollingFrequency * 1000) | ||||
16 | }; | ||||
17 | }); |