Pages form the bulk of an app. A Page instance contains the following:
pageId string that is used for page lookup and navigation.ctl.createPage(info)
Pages are created using the ctl.createPage() factory function.
close()
The Controller calls the close() method when the page is dismissed. The page can use it to remove event listeners or do other cleanup from open(). The default close() method does nothing.
component()
The Nav page or other navigation component calls the component() method to retrieve a Component subclass that will display this page's content in the View. The default component() returns a Component class whose Component render() method returns the results of calling the Page instance's render() method. Therefore, a page can supply a simpler render() method instead of implementing a full Component subclass.
A Template object, a string, a number, a DOM node, a Component object, or an array containing a mix of these types.
deactivate()
The Controller calls the deactivate() method when a new popup page is opened on top of this page. It returns the state values required to restore this page's state when the pages on top are dismissed. The default deactivate() method returns null.
Any JavaScript type. This value is used as the state argument for reactivate(state) when the page is reactivated.
getSavedState(state)
The Controller calls each page's getSavedState() method when the application state is being saved to local device storage or in the cloud. The method adds the information required to restore the page's state variables to the state object.
The default getSavedState() method adds the information for the page's state variables marked for saving locally or globally. The value stored for each state variable's ID key is the result of calling the state variable's getSavedState() method.
statehasChanged()
The Controller calls the hasChanged() method to determine if the page Model computations need to be recomputed. It returns true if the page's inputs have changed since the last time they were interrogated. The default hasChanged() method maintains an array of SvMonitors for the state variables marked for saving locally or globally, and returns true is any of the SvMonitors hasChanged() methods returns true.
init()
The Controller calls the init() method after the application is fully loaded on startup and all application pages and their associated state variables are created. However, the state variable value may not be restored from the previous session. This allows the page to do any pre-setup before being opened.
open(arg)
The Controller calls the open() method when a page is opened. This allows the page to do any pre-setup before Model computation.
argreactivate(state)
The Controller calls the reactivate() method when the popup pages above the page are dismissed, and the page is now the topmost page. The state argument is the value the deactivate() method returned previously for this page.
statedeactivate() method.render()
The default component() returns a Component class whose Component render() method returns the results of calling the Page instance's render() method. Therefore, a page can supply a simpler render() method instead of implementing a full Component subclass.
A Template object, a string, a number, a DOM node, a Component object, or an array containing a mix of these types that represents the contents of the page when opened.
renderHelp()
When initialized, the built-in Help page automatically collects the templates returned by calling the renderHelp() method. It then uses that information, along with the page's pageId and title, as a help topic.
A Template object, a string, a number, a DOM node, a Component object, or an array containing a mix of these types that represents the help information displayed when the page is selected as the help topic.
setSavedState(state)
The Controller calls each page's setSavedState() method when the application state is being restored from local device storage or from the cloud. The method uses the information in the state object to restore the page's state variables. The state object uses the state variable ID as a key for each state variable's information.
The default setSavedState() method restores the state of the page's state variables marked for saving locally or globally. The state is restored by calling the state variable's setSavedState() method passing the state object's value for the state variables.
stateupgradeSavedState(state, version)
The Controller calls each page's setSavedState() method after the application state to be restored has been retrieved from local device storage or from the cloud. The method updates the page's state variable information in the state object as required to upgrade the information of the information saved by an older application version to the current application version. The method interprets the version string and updates the relevant keys and values as required.
See also:
stateversion. See [versionCompare()`](utilities/utilities.md#versioncompare)Returns true if the upgrade was successful. Returns false if the information was corrupt or too old.
computeInfoThe computeInfo array from the info object passed to ctl.createPage().
An array.
isOpenTrue if the page is opened, whether activated or deactivated.
A Boolean.
isActiveTrue if the page is opened and activated.
A Boolean.
pageIdThe page's ID.
A string.
stateVarInfoThe stateVarInfo array from the info object passed to ctl.createPage().
An array.
tipInfoThe tipInfo array from the info object passed to ctl.createPage().
An array.
titleThe page's title.
An string.