fix(animations): generate aot code for animation trigger output events#12291
fix(animations): generate aot code for animation trigger output events#12291alxhub merged 1 commit intoangular:masterfrom
Conversation
|
@tbosch Also, we now explose |
e78a4bc to
f655e78
Compare
|
Aot Sample: _View_App0.prototype.detectChangesInternal = function(throwOnChange) {
var self = this;
var transitionAnimation = null ;
var currVal_4 = self.context.openClose;
if (jit_checkBinding6(throwOnChange, self._expr_4, currVal_4)) {
var oldRenderVar = self._expr_4;
if ((oldRenderVar == jit_UNINITIALIZED5) ) {
(oldRenderVar = 'void');
}
var newRenderVar = currVal_4;
if ((newRenderVar == jit_UNINITIALIZED5) ) {
(newRenderVar = 'void');
}
transitionAnimation = self.componentType.animations['myTrigger'](self, self._el_8, oldRenderVar, newRenderVar);
self._expr_4 = currVal_4;
}
if (transitionAnimation) {
transitionAnimation.player.onDone(self.eventHandler(self._handle_myTrigger_8_0.bind(self, transitionAnimation)));
}
if (transitionAnimation) {
transitionAnimation.player.onStart(self.eventHandler(self._handle_myTrigger_8_1.bind(self, transitionAnimation)));
}
self.detectContentChildrenChanges(throwOnChange);
self.detectViewChildrenChanges(throwOnChange);
} |
|
main refactorings:
|
f655e78 to
374d991
Compare
|
Codegen looks like this now: _View_App0.prototype.detectChangesInternal = function(throwOnChange) {
var self = this;
var currVal_4 = self.context.openClose;
if (jit_checkBinding6(throwOnChange, self._expr_4, currVal_4)) {
var oldRenderVar = self._expr_4;
if ((oldRenderVar == jit_UNINITIALIZED5) ) {
(oldRenderVar = 'void');
}
var newRenderVar = currVal_4;
if ((newRenderVar == jit_UNINITIALIZED5) ) {
(newRenderVar = 'void');
}
var animationTransition_myTrigger = self.componentType.animations['myTrigger'](self, self._el_8, oldRenderVar, newRenderVar);
animationTransition_myTrigger.onDone(self._handle_myTrigger_8_0.bind(self));
animationTransition_myTrigger.onStart(self._handle_myTrigger_8_1.bind(self));
self._expr_4 = currVal_4;
}
self.detectContentChildrenChanges(throwOnChange);
self.detectViewChildrenChanges(throwOnChange);
}; |
374d991 to
ed328c5
Compare
ed328c5 to
af0e84f
Compare
There was a problem hiding this comment.
Remove the variables oldRenderVar and newRenderVar, and use a ternary expression instead.
...animationFnExpr.callFn([o.THIS_EXPR,
oldRenderValue.equals(o.importExpr(resolveIdentifier(Identifiers.UNINITIALIZED))
.conditional(oldRenderVar, emptyStateValue)),
newRenderValue.equals(o.importExpr(resolveIdentifier(Identifiers.UNINITIALIZED))
.conditional(newRenderVar, emptyStateValue)),
...
There was a problem hiding this comment.
This should be o.importType(resolveIdentifier(Identifiers.AnimationTransition)), as the factory returns an AnimationTransition, right?
There was a problem hiding this comment.
remove _ prefix, and don't upper case everything. This is just a variable here, not a constant defined at the top leve.
There was a problem hiding this comment.
Move this further down, right before you declare the variable (as it is not used before that).
There was a problem hiding this comment.
Why are we always creating the animation again on view detach?
There was a problem hiding this comment.
this variable is not used any more.
There was a problem hiding this comment.
Use .callMethod(o.BuiltinMethod.Bind, ..., don't pass in bind as a string.
There was a problem hiding this comment.
Move the logic here into CompileEventListener.listenToAnimation.
There was a problem hiding this comment.
Why does the player need to be public?
There was a problem hiding this comment.
Don't use named arguments here, just positional ones and declare the fields as well. E.g.
constructor(private _player: AnimationPlayer, private _fromState: string, ...) {}
There was a problem hiding this comment.
Please ping @IgorMinar whether this is a breaking change, and we need to make this field optional. I don't expect users to new up their own AnimationTransitionEvent.
af0e84f to
b5702b1
Compare
b5702b1 to
6466f4b
Compare
6466f4b to
7d0a494
Compare
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.