feat(events): adds support for injectable angular event emitters.

Event emitters can be injected into Directives. Event emitters take over
browser events with the same name. Emitted events do not bubble. Event
emitters can be injected even if there is no corresponding callback in
the template.

Use as follows:
@Decorator(...)
class MyDec(@EventEmitter('click') clickEmitter) {
 ...
 fireClick() {
  var eventData = {...};
  this._clickEmitter(eventData);
 }
}
This commit is contained in:
Rado Kirov
2015-01-16 15:30:22 -08:00
parent 683bb6e5a2
commit fd34a56347
7 changed files with 171 additions and 42 deletions

View File

@ -31,11 +31,11 @@ export function main() {
var bindings = [A, B, C];
var proto = new ProtoElementInjector(null, 0, bindings);
var elementInjector = proto.instantiate(null,null);
var elementInjector = proto.instantiate(null,null, null);
function instantiate () {
for (var i = 0; i < iterations; ++i) {
var ei = proto.instantiate(null, null);
var ei = proto.instantiate(null, null, null);
ei.instantiateDirectives(appInjector, null, null);
}
}