A duck-typing interface that defines a contract for managing animations during ojModule View transitions.
Use 'animation' option on the ojModule binding to set ModuleAnimation instance.
Methods
-
animate(context) : {Promise}
-
Prepares animation by designating where the new View should be inserted and optionally specifying where the old View should be moved
Parameters:
Name Type Description contextObject a context object with the keys detailed below Properties
Name Type Description nodeNode a DOM node where the ojModule binding is attached. This may be a virtual/comment node valueAccessorfunction value accessor for the binding isInitialboolean true if the initial View is about to be displayed, false otherwise oldViewModelObject the instance of the ViewModel for the old View newViewModelObject the instance of the ViewModel for the new View newViewParentNode the 'newViewParent' parameter returned by the prepareAnimation() method oldViewParentNode the 'oldViewParent' parameter returned by the prepareAnimation() method removeOldViewfunction calling this function will remove the DOM nodes representing the old View. If this function is not invoked by the ModuleAnimation implementation, and the old View is still connected when the Promise is resolved, the old View will be removed by ojModule. insertNewViewfunction calling this function will insert new View's DOM nodes into the location managed by the ojModule. If this function is not invoked by the ModuleAnimation implementation, and the new View is not at its intended location when the Promise is resolved, the View will be moved by ojModule. oldDomNodesArray an array of DOM nodes representing the old View Returns:
- a Promise that should be resolved when the animation, moving/removing of DOM nodes and the cleanup are complete. Note that ojModule will not be able to navigate to a new View until the Promise is resolved.
- Type
- Promise
-
canAnimate(context) : {boolean}
-
Optional method that determines whether the animated transition should proceed. If the method is not implemented, all transitions will be allowed to proceed
Parameters:
Name Type Description contextObject a context object with the keys detailed below Properties
Name Type Description nodeNode a DOM node where the ojModule binding is attached. This may be a virtual/comment node valueAccessorfunction value accessor for the binding isInitialboolean true if the initial View is about to be displayed, false otherwise oldViewModelObject the instance of the ViewModel for the old View newViewModelObject the instance of the ViewModel for the new View Returns:
true if animation should proceed, false otherwise
- Type
- boolean
-
prepareAnimation(context) : (nullable) {Object}
-
Prepares animation by designating where the new View should be inserted and optionally specifying where the old View should be moved
Parameters:
Name Type Description contextObject a context object with the keys detailed below Properties
Name Type Description nodeNode a DOM node where the ojModule binding is attached. This may be a virtual/comment node valueAccessorfunction value accessor for the binding isInitialboolean true if the initial View is about to be displayed, false otherwise oldViewModelObject the instance of the ViewModel for the old View newViewModelObject the instance of the ViewModel for the new View Returns:
an object that may contain values for the following keys:
- 'newViewParent' - a DOM node where the new View should be inserted. If this parameter is not specified, the new View will be inserted into the node associated with the ojModule binding
- 'oldViewParent' - a DOM node where the old View should be moved. If this parameter is not specified, the old View will not be moved
- Type
- Object