1 2angular.module('irk') 3 .service('Session', function() { 4 var observers = []; 5 6 this.registerObserverCallback = function(callback) { 7 observers.push(callback); 8 }; 9 10 this.removeObserverCallback = function(callback) { 11 var index = observers.indexOf(callback); 12 if (index > -1) { 13 observers.splice(index, 1); 14 } 15 }; 16 17 var notifyObservers = function() { 18 angular.forEach(observers, function(callback) { 19 callback(); 20 }); 21 }; 22 23 this.create = function() { 24 notifyObservers(); 25 }; 26 27 this.refresh = function() { 28 notifyObservers(); 29 }; 30 31 this.destroy = function() { 32 notifyObservers(); 33 }; 34 }) 35 .run(function($rootScope, AUTH_EVENTS, Session) { 36 $rootScope.routeAfterLogin = null; 37 for (var event in AUTH_EVENTS) { 38 $rootScope.$on(AUTH_EVENTS[event], function() { 39 Session.destroy(); 40 }); 41 } 42 });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.