chore(animation): pass instance to onFinish callbacks

This commit is contained in:
Adam Bradley
2016-02-21 13:52:25 -06:00
parent 3c8daa0781
commit b62725c8ce
4 changed files with 43 additions and 11 deletions

View File

@ -22,6 +22,35 @@ class E2EPage {
a.easing(this.easing);
a.play();
}
memoryCheck() {
let self = this;
let count = 0;
function play() {
count++;
if (count >= 100) {
console.log('Play done');
return;
}
console.log('Play', count);
let a = new Animation('.green');
a.fromTo('translateX', '0px', '200px');
a.duration(self.duration);
a.easing(self.easing);
a.onFinish((animation) => {
setTimeout(() => {
play();
}, 100);
animation.destroy();
});
a.play();
}
play();
}
}

View File

@ -28,6 +28,10 @@
<button ion-item (click)="playGreen()">
Play
</button>
<button ion-item (click)="memoryCheck()">
Memory Check
</button>
</ion-list>
</ion-content>

View File

@ -1081,13 +1081,13 @@ export class NavController extends Ion {
}
// create a callback for when the animation is done
transAnimation.onFinish((hasCompleted: boolean) => {
transAnimation.onFinish((trans: Transition) => {
// transition animation has ended
// destroy the animation and it's element references
transAnimation.destroy();
trans.destroy();
this._afterTrans(enteringView, leavingView, opts, hasCompleted, done);
this._afterTrans(enteringView, leavingView, opts, trans.hasCompleted, done);
});
// cool, let's do this, start the transition