Interface: ConventionMethods

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

oj.ModuleBinding. ConventionMethods

Version:
  • 3.2.0
A duck-typing interface that defines optional ViewModel methods that the ojModule binding will invoke by convention
Source:

Methods

dispose(info)

This method may be implemented by the ViewModel to perform cleanup tasks. Note that this method will be invoked only once before all binding's refernces to the ViewModel are released.
Parameters:
Name Type Description
info Object an object with the following key-value pairs:
Properties
Name Type Description
element Node DOM element or where the binding is attached. This may be a 'virtual' element (comment node)
valueAccessor Function binding's value accessor
Source:

handleActivated(info) → {Promise|undefined}

Optional ViewModel method invoked when this ViewModel is about to be used for the View transition
Parameters:
Name Type Description
info Object an object with the following key-value pairs:
Properties
Name Type Description
element Node DOM element or where the binding is attached. This may be a 'virtual' element (comment node)
valueAccessor Function binding's value accessor
Source:
Returns:
- If the callback returns a Promise, the next phase (attaching DOM) will be delayed until the promise is resolved
Type
Promise | undefined

handleAttached(info)

Optional ViewModel method invoked after the View is inserted into the document DOM
Parameters:
Name Type Description
info Object an object with the following key-value pairs:
Properties
Name Type Description
element Node DOM element or where the binding is attached. This may be a 'virtual' element (comment node)
valueAccessor Function binding's value accessor
fromCache boolean a boolean indicating whether the module was retrieved from cache
Source:

handleBindingsApplied(info)

Optional ViewModel method invoked after the bidnings are applied on this View. If the current View is retrieved from cache, the bindings will not be re-applied, and this callback will not be invoked.
Parameters:
Name Type Description
info Object an object with the following key-value pairs:
Properties
Name Type Description
element Node DOM element or where the binding is attached. This may be a 'virtual' element (comment node)
valueAccessor Function binding's value accessor
Source:

handleDeactivated(info)

Optional ViewModel method invoked when the View/ViewModel combination becomes inactive
Parameters:
Name Type Description
info Object an object with the following key-value pairs:
Properties
Name Type Description
element Node DOM element or where the binding is attached. This may be a 'virtual' element (comment node)
valueAccessor Function binding's value accessor
Source:

handleDetached(info)

Optional ViewModel method invoked after the View is removed from the document DOM
Parameters:
Name Type Description
info Object an object with the following key-value pairs:
Properties
Name Type Description
element Node DOM element or where the binding is attached. This may be a 'virtual' element (comment node)
valueAccessor Function binding's value accessor
cachedNodes Array an Array containing cached nodes for the View (if the cache is enabled)
Source:

handleTransitionCompleted(info)

Optional ViewModel method invoked after transition to the new View is complete. That includes any possible animation between the old and the new View
Parameters:
Name Type Description
info Object an object with the following key-value pairs:
Properties
Name Type Description
element Node DOM element or where the binding is attached. This may be a 'virtual' element (comment node)
valueAccessor Function binding's value accessor
Source:

initialize(info) → {Object|undefined}

This method may be implemented on the ViewModel to perform initialization tasks. The method will be invoked only if the ViewModel factory or the AMD module returns a ViewModel instance (as opposed to a constructor function). Note that this method will be invoked only once when the ViewModel is created, i.e. it will not be called when the View is being brought from cache
Parameters:
Name Type Description
info Object an object with the following key-value pairs:
Properties
Name Type Description
element Node DOM element or where the binding is attached. This may be a 'virtual' element (comment node)
valueAccessor Function binding's value accessor To retrieve the object passed as the 'params' option on the binding, use ko.utils.unwrapObservable(info.valueAccessor()).params if the entire binding value is an observable or ko.utils.unwrapObservable(info.valueAccessor().params) if the bidning value is a plain object literal.
Source:
Returns:
- optional return value that will be used as the new ViewModel instance
Type
Object | undefined