refactor(compiler): generate host listeners in DirectiveWrappers

Part of #11683
This commit is contained in:
Tobias Bosch
2016-10-26 16:58:35 -07:00
committed by vsavkin
parent a664aba2c9
commit 32feb8a532
15 changed files with 628 additions and 316 deletions

View File

@ -285,7 +285,9 @@ export abstract class AppView<T> {
}
}
eventHandler<E, R>(cb: (event?: E) => R): (event?: E) => R { return cb; }
eventHandler<E, R>(cb: (eventName: string, event?: E) => R): (eventName: string, event?: E) => R {
return cb;
}
throwDestroyedError(details: string): void { throw new ViewDestroyedError(details); }
}
@ -368,12 +370,12 @@ export class DebugAppView<T> extends AppView<T> {
}
}
eventHandler<E, R>(cb: (event?: E) => R): (event?: E) => R {
eventHandler<E, R>(cb: (eventName: string, event?: E) => R): (eventName: string, event?: E) => R {
var superHandler = super.eventHandler(cb);
return (event?: any) => {
return (eventName: string, event?: any) => {
this._resetDebug();
try {
return superHandler(event);
return superHandler(eventName, event);
} catch (e) {
this._rethrowWithContext(e);
throw e;