(function () { "use strict"; angular.module("agora.plus.eventStore", []) .service("EventStoreService", [ EventStoreService ]); function EventStoreService() { var eventStore = []; return { getEventStore: function (eventType) { var aux; angular.forEach(eventStore, function (value, key) { if (eventType == value.eventType) { aux = value; return value; } }); return aux; }, /* event is a json object with the following format: { eventType: name of the event func: function(someParameter){...} } */ setEventStore: function (event) { eventStore.push(event); } }; } }).call();