Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Attributes
-
animation :Object
-
Instance of the oj.ModuleElementAnimation duck-typing interface that will manage animation effects during View transitions.
- Default Value:
null
Names
Item Name Property animationProperty change event animationChangedProperty change listener attribute (must be of type function) on-animation-changed -
config :Object
-
Configuration object that defines a view and a corresponding view model responsible the markup section under oj-module. An application can also specify a clean up mode for the view as a part of the configuration object. See details for each attribute.
Names
Item Name Property configProperty change event configChangedProperty change listener attribute (must be of type function) on-config-changedExamples
Initialize the ojModule element with the
configattribute:<oj-module config='[[moduleConfig]]'></oj-module>Get or set the
acceptproperty after initialization:// getter var config = myModule.config; // setter myModule.config = {'view':view,'viewModel':viewModel}; // where view is an Array of DOM nodes and viewModel is a model object for the view -
config.cleanup-mode :string
-
Defines the clean up mode for the view.
- Default Value:
"onDisconnect"
Supported Values:
Name Type Description "none"string Use the setting to preserve the view, e.g. if the view and view model will be stored in external cache. "onDisconnect"string The View nodes will be destroyed on disconnect. Names
Item Name Property config.cleanupMode -
config.view :Array.<Node>
-
Defines the view for the ojModule.
Note that oj-module will not be cloning the node array before using it as the module's View and applying bindings to it. If the application needs to have an access to the original node array, it should be setting the 'view' property to a cloned copy.
- Default Value:
null
Names
Item Name Property config.view -
config.view-model :Object
-
Defines model for the view.
The following optional lifecycle methods can be defined on the ViewModel object and will be called at the corresponding lifecycle stage. See View Model Lifecycle section
- Default Value:
null
Names
Item Name Property config.viewModel
Events
-
ojTransitionEnd
-
Triggered after transition to the new View is complete. That includes any possible animation between the old and the new View.
Properties:
All of the event payloads listed below can be found under
event.detail.Name Type Description viewModelObject ViewModel for the new View. Examples
Specify an
ojTransitionEndlistener via the DOM attribute:<oj-module on-oj-transition-end='[[listener]]'></oj-module>Specify an
ojTransitionEndlistener via the JavaScript property:myModule.onOjTransitionEnd = listener;Add an
ojTransitionEndlistener via theaddEventListenerAPI:myModule.addEventListener('ojTransitionEnd', listener); -
ojTransitionStart
-
Triggered before transition to the new View is started - before View is inserted into the DOM.
Properties:
All of the event payloads listed below can be found under
event.detail.Name Type Description viewModelObject ViewModel for the new View. Examples
Specify an
ojTransitionStartlistener via the DOM attribute:<oj-module on-oj-transition-start='[[listener]]'></oj-module>Specify an
ojTransitionStartlistener via the JavaScript property:myModule.onOjTransitionStart = listener;Add an
ojTransitionStartlistener via theaddEventListenerAPI:myModule.addEventListener('ojTransitionStart', listener); -
ojViewConnected
-
Triggered after the View is inserted into the DOM.
Properties:
All of the event payloads listed below can be found under
event.detail.Name Type Description viewModelObject ViewModel for the View being attached to the DOM. Examples
Specify an
ojViewConnectedlistener via the DOM attribute:<oj-module on-oj-view-connected='[[listener]]'></oj-module>Specify an
ojViewConnectedlistener via the JavaScript property:myModule.onOjViewConnected = listener;Add an
ojViewConnectedlistener via theaddEventListenerAPI:myModule.addEventListener('ojViewConnected', listener); -
ojViewDisconnected
-
Triggered after the View is removed from the DOM
Properties:
All of the event payloads listed below can be found under
event.detail.Name Type Description viewModelObject An array of DOM nodes that represent the disconnected View. The application can use the nodes to store them in cache. viewArray.<Node> ViewModel for the new View. Examples
Specify an
ojViewDisconnectedlistener via the DOM attribute:<oj-module on-oj-view-disconnected='[[listener]]'></oj-module>Specify an
ojViewDisconnectedlistener via the JavaScript property:myModule.onOjViewDisconnected = listener;Add an
ojViewDisconnectedlistener via theaddEventListenerAPI:myModule.addEventListener('ojViewDisconnected', listener);