Interface: ConventionMethods

Oracle® JavaScript Extension Toolkit (JET)
16.0.0

F83701-01

Module:
  • ojmodule

QuickNav

Description

A duck-typing interface that defines optional ViewModel methods that the ojModule binding will invoke by convention


Usage

For additional information visit:


A duck-typing interface that defines optional ViewModel methods that the ojModule binding will invoke by convention

Methods

dispose(info) : {void}

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
Returns:
Type
void

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
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) : {void}

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
Returns:
Type
void

handleBindingsApplied(info) : {void}

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
Returns:
Type
void

handleDeactivated(info) : {void}

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
Returns:
Type
void

handleDetached(info) : {void}

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)
Returns:
Type
void

handleTransitionCompleted(info) : {void}

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
Returns:
Type
void

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.
Returns:

- optional return value that will be used as the new ViewModel instance

Type
Object | undefined