Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to detect event listeners of a broadcast?

When broadcasting from my rootScope, if there are no event listeners listening for my event, I'd like to run my own function in the rootScope. Is this possible?

like image 678
adam0101 Avatar asked Oct 24 '14 22:10

adam0101


1 Answers

I'm not near a computer where I can quickly validate, but i think you can use:

$rootScope.$$listenerCount[eventName] === 0
like image 110
New Dev Avatar answered Oct 08 '22 15:10

New Dev