(eventHandlers)
| 12570 | return promise; |
| 12571 | |
| 12572 | function createApplyHandlers(eventHandlers) { |
| 12573 | if (eventHandlers) { |
| 12574 | var applyHandlers = {}; |
| 12575 | forEach(eventHandlers, function(eventHandler, key) { |
| 12576 | applyHandlers[key] = function(event) { |
| 12577 | if (useApplyAsync) { |
| 12578 | $rootScope.$applyAsync(callEventHandler); |
| 12579 | } else if ($rootScope.$$phase) { |
| 12580 | callEventHandler(); |
| 12581 | } else { |
| 12582 | $rootScope.$apply(callEventHandler); |
| 12583 | } |
| 12584 | |
| 12585 | function callEventHandler() { |
| 12586 | eventHandler(event); |
| 12587 | } |
| 12588 | }; |
| 12589 | }); |
| 12590 | return applyHandlers; |
| 12591 | } |
| 12592 | } |
| 12593 | |
| 12594 | |
| 12595 | /** |
no test coverage detected