App

App

The App handles the reinitialization and loading of the app depending on which platform (Android, Chrome, web) the app is running, who is logged in etc. The App should be serializable to save state to local storage for the next run.

Constructor

new App()

Source:
Tutorials:
  • Tutorial: tests/app/AppTest.js
Properties:
Name Type Description
authentication Authentication The auth member variable is an Authentication object permits access to the login and logout functions, and the database of users depending on whether the app is online or not. The authentication is the primary way to access the current user.
corpus Corpus The corpus is a Corpus object which will permit access to the datum, the data lists and the sessions. The corpus feeds the search object with indexes and fields for advanced search, the corpus has datalists, has teams with permissions, has a confidentiality_encryption key, it's datum have sessions, its datalists and datum have export.
search Search The current search details.
currentSession Session The session that is currently open.
currentDataList DataList The datalist that is currently open.

Extends

Members

addActivity

Source:
Saves a json file via REST to a couchdb, must be online.

isOnlineOnly

Source:
If not running offline on an android or in a chrome extension, assume we are online.

processRouteParams

Source:
This function creates the backbone objects, and links them up so that they are ready to be used in the views. This function should be called on app load, either by main, or by welcome new user. This function should not be called at any later time as it will break the connection between the views and the models. To load different models into the app after it has first loaded, use the loadFieldDBObjectsById function below.

save

Source:
This function saves the dashboard session, datalist and then corpus. Its success callback is called if all saves succeed, its fail is called if any fail.

warnUserAboutSavedSyncedStateBeforeUserLeaves

Source:
This function is used to save the entire app state that is needed to load when the app is re-opened. http://stackoverflow.com/questions/7794301/window-onunload-is-not-working-properly-in-chrome-browser-can-any-one-help-me $(window).on("beforeunload", function() { return "Your own message goes here..."; });