var angular = require('angular');
require('../modules');
require('./userDeptList');
require('./userListOfSameDept');

var module = angular.module('linker.services');

module.factory('LinkerListener', function($rootScope, userDeptList, userListOfSameDept) {

  $rootScope.$on('online', function() {
    userDeptList.sync().then(function() {
      return userListOfSameDept.loadFromCache();
    });
  });
});
