fix(animations): generate aot code for animation trigger output events (#12291)

Closes #11707
Closes #12291
This commit is contained in:
Matias Niemelä
2016-10-18 17:16:51 -07:00
committed by Alex Rickabaugh
parent 8409b65153
commit 6e5f8b59b3
12 changed files with 116 additions and 116 deletions

View File

@ -0,0 +1,34 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {AnimationPlayer} from './animation_player';
import {AnimationTransitionEvent} from './animation_transition_event';
export class AnimationTransition {
constructor(
private _player: AnimationPlayer, private _fromState: string, private _toState: string,
private _totalTime: number) {}
private _createEvent(phaseName: string): AnimationTransitionEvent {
return new AnimationTransitionEvent({
fromState: this._fromState,
toState: this._toState,
totalTime: this._totalTime,
phaseName: phaseName
});
}
onStart(callback: (event: AnimationTransitionEvent) => any): void {
const event = this._createEvent('start');
this._player.onStart(() => callback(event));
}
onDone(callback: (event: AnimationTransitionEvent) => any): void {
const event = this._createEvent('done');
this._player.onDone(() => callback(event));
}
}

View File

@ -41,11 +41,13 @@ export class AnimationTransitionEvent {
public fromState: string;
public toState: string;
public totalTime: number;
public phaseName: string;
constructor({fromState, toState,
totalTime}: {fromState: string, toState: string, totalTime: number}) {
constructor({fromState, toState, totalTime, phaseName}:
{fromState: string, toState: string, totalTime: number, phaseName: string}) {
this.fromState = fromState;
this.toState = toState;
this.totalTime = totalTime;
this.phaseName = phaseName;
}
}