Class: AppModel

AppModel()

A utility model that contains top-level configuration and storage for the application

Constructor

new AppModel()

Source:

Extends

  • Backbone.Model

Methods

addCSS(css, id)

Given a string of CSS and an associated unique ID, check whether that CSS file was already added to the document head, and add it if not. Prevents adding the CSS file multiple times if the view is loaded more than once. The first time each CSS path is added, we need to save a record of the event. It doesn't work to just search the document head for the style element to determine if the CSS has already been added, because views may be initialized too quickly, before the previous instance has had a chance to add the stylesheet element.
Parameters:
Name Type Description
css string A string containing CSS styles
id string A unique ID for the CSS styles which has not been used anywhere else in the app.
Source:

getActiveAltRepo() → {object}

Gets the currently-active alternative repository that is configured in this AppModel.
Source:
Returns:
Type
object

getDataONEMNAPIs(baseUrlopt) → {object}

Constructs the DataONE API URLs for the given baseUrl
Parameters:
Name Type Attributes Description
baseUrl string <optional>
The baseUrl to use in the URLs. If not specified, it uses the AppModel attributes.
Source:
Returns:
Type
object

removeCSS(id)

Remove CSS from the app that was added using the AppModel#addCSS function.
Parameters:
Name Type Description
id string A unique ID for the CSS styles which has not been used anywhere else in the app. The same ID used to add the CSS with AppModel#addCSS
Source:

setActiveAltRepo()

Gets the default alternate repository and sets it as the active alternate repository. If a default alt repo (AppConfig#defaultAlternateRepositoryId) isn't configured, the first alt repo in the AppConfig#alternateRepositories list is used.
Source:
Fires:
  • AppModel#change:activeAlternateRepositoryId