(eventHandlers)
| 13362 | return promise; |
| 13363 | |
| 13364 | function createApplyHandlers(eventHandlers) { |
| 13365 | if (eventHandlers) { |
| 13366 | var applyHandlers = {}; |
| 13367 | forEach(eventHandlers, function(eventHandler, key) { |
| 13368 | applyHandlers[key] = function(event) { |
| 13369 | if (useApplyAsync) { |
| 13370 | $rootScope.$applyAsync(callEventHandler); |
| 13371 | } else if ($rootScope.$$phase) { |
| 13372 | callEventHandler(); |
| 13373 | } else { |
| 13374 | $rootScope.$apply(callEventHandler); |
| 13375 | } |
| 13376 | |
| 13377 | function callEventHandler() { |
| 13378 | eventHandler(event); |
| 13379 | } |
| 13380 | }; |
| 13381 | }); |
| 13382 | return applyHandlers; |
| 13383 | } |
| 13384 | } |
| 13385 | |
| 13386 | |
| 13387 | /** |
no test coverage detected