Blame view

resources/js/media/mediaDataService.js 565 Bytes
e77200db5   nologostudio.ru   Initial commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  angular.module('footyroom').service('mediaData', ['$window', function ($window) {
      var callbacks = [];
      var selected;
  
      this.getMedia = function () {
          return $window.DataStore.media;
      };
  
      this.onSelect = function (callback) {
          callbacks.push(callback);
      };
  
      this.getSelected = function () {
          return selected;
      };
  
      this.setSelected = function (selectedMedia, scroll) {
          selected = selectedMedia;
  
          callbacks.forEach((callback) => {
              callback(selectedMedia, scroll);
          });
      };
  }]);