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 context
Object a context object with the keys detailed below Properties
Name Type Description node
Node a DOM node where the ojModule binding is attached. This may be a virtual/comment node valueAccessor
function value accessor for the binding isInitial
boolean true if the initial View is about to be displayed, false otherwise oldViewModel
Object the instance of the ViewModel for the old View newViewModel
Object the instance of the ViewModel for the new View newViewParent
Node the 'newViewParent' parameter returned by the prepareAnimation() method oldViewParent
Node the 'oldViewParent' parameter returned by the prepareAnimation() method removeOldView
function 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. insertNewView
function 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. oldDomNodes
Array 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 context
Object a context object with the keys detailed below Properties
Name Type Description node
Node a DOM node where the ojModule binding is attached. This may be a virtual/comment node valueAccessor
function value accessor for the binding isInitial
boolean true if the initial View is about to be displayed, false otherwise oldViewModel
Object the instance of the ViewModel for the old View newViewModel
Object 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 context
Object a context object with the keys detailed below Properties
Name Type Description node
Node a DOM node where the ojModule binding is attached. This may be a virtual/comment node valueAccessor
function value accessor for the binding isInitial
boolean true if the initial View is about to be displayed, false otherwise oldViewModel
Object the instance of the ViewModel for the old View newViewModel
Object 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