(function () { "use strict"; angular.module("enrDetailsPaneModule") .factory("detailsData", ["$rootScope", function ($rootScope) { var dataChangedEventName = "detailsDataChanged"; var dataRefChangedEventName = "detailsRefDataChanged"; var dataOffChangedEventName = "dataOffChangedEventName"; var curJson, curRefJson, curOfficeJson; var setData = function (json) { curJson = json; $rootScope.$broadcast(dataChangedEventName, curJson); // (Potentially) costly synchronous logic complete. Can safely remove busy working dialog. $rootScope.$broadcast("POP_BUSY_WORKING", curJson); }; var setOfficeData = function (json) { curOfficeJson = json; $rootScope.$broadcast(dataOffChangedEventName, curOfficeJson); // (Potentially) costly synchronous logic complete. Can safely remove busy working dialog. $rootScope.$broadcast("POP_BUSY_WORKING", curJson); }; var setRefData = function (json) { curRefJson = json; $rootScope.$broadcast(dataRefChangedEventName, curRefJson); // (Potentially) costly synchronous logic complete. Can safely remove busy working dialog. $rootScope.$broadcast("POP_BUSY_WORKING", curRefJson); }; return { dataChangedEventName: dataChangedEventName, isDataPresent: function () { return curJson !== undefined && curJson !== null; }, getData: function () { return curJson; }, setData: function (json) { setData(json) }, clearData: function () { setData(undefined); }, //office data change on mouse hover dataOffChangedEventName: dataOffChangedEventName, isOffDataPresent: function () { return curOfficeJson !== undefined && curOfficeJson !== null; }, getOfficeData: function () { return curOfficeJson; }, setOfficeData: function (json) { setOfficeData(json) }, //Ref data change on mouse hover dataRefChangedEventName:dataRefChangedEventName, isRefDataPresent: function () { return curRefJson !== undefined && curRefJson !== null; }, getRefData: function () { return curRefJson }, setRefData: function (json) { setRefData(json) } }; }]); }());