$emit $broadcast synchronous or asynchronous?

angularjs, javascript

Solution

They are synchronous.

See also https://groups.google.com/d/msg/angular/yyH3FYAy5ZY/APANNMnolD8J

Problem

Are `$scope.$emit()` and `$scope.$broadcast()` synchronous or asynchronous in the literal sense? For example, in the cases ``` $scope.$emit() console.log(" I am finished sending events"); ``` and ``` $scope.$broadcast() console.log(" I am finished sending events"); ``` If all the listeners are synchronous (have no ajax calls etc) will the logging only happen after all listeners receive their events?

Original source