perf(Scope): exit $broadcast early if nobody is listening for the given event

This commit is contained in:
Igor Minar
2014-08-10 07:08:57 -07:00
parent 36e35b2cb1
commit a09fa35641

View File

@@ -1148,8 +1148,11 @@ function $RootScopeProvider(){
event.defaultPrevented = true;
},
defaultPrevented: false
},
listenerArgs = concat([event], arguments, 1),
};
if (!target.$$listenerCount[name]) return event;
var listenerArgs = concat([event], arguments, 1),
listeners, i, length;
//down while you can, then up and next sibling or up and next sibling until back at root