Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a Framework.js application instance. Application provides library and module loading services and offers application-level lifecycle support and infrastructure. An instance of Application will utilize framework services to provide and manage an application lifecycle for a collection of modules to participate in.

Hierarchy

Index

Constructors

constructor

  • new Application(configObject: any, hostElement?: HTMLElement, id?: string, configTokens?: object, debug?: string | boolean): Application
  • Creates a new instance of Application.

    Parameters

    • configObject: any

      Either a string URI, or a configuration object. If a string is passed, it will be treated as a URI and the application will attempt to fetch it. If an object is passed, it will be used as configuration.

    • Optional hostElement: HTMLElement

      An optional container element of the application. The application will constrain its initial region discovery to within this element. This allows multiple framework applications to live on the same page without interfering with each other.

    • Optional id: string

      An optional application ID. This will be used to prefix storage keys, allowing for multiple distinct applications to live and store compartmentalized data on the same domain.

    • Optional configTokens: object

      An optional set of tokens that can be referenced in configuration.

      • [token: string]: string
    • Optional debug: string | boolean

    Returns Application

Events

onLibrariesDownloaded

  • Occurs when all libraries for this application have been processed. Invoked even if one or more libraries failed to download. To check if a specific library has successfully downloaded, use the hasLibrary function or check the libraries array on the app.

    Parameters

    • app: Application

      A {@link geocortex.framework.application.Application}.

    Returns void

Properties

Private _debug

_debug: any

Private _hasShell

_hasShell: boolean

Private _internalDebugEnabled

_internalDebugEnabled: boolean

Protected _resourceDictionaries

_resourceDictionaries: object

A collection of resource dictionaries, keyed by locale

Type declaration

  • [key: string]: any

Private _shellStabilized

_shellStabilized: boolean

abortInitialization

abortInitialization: boolean

Aborts initialization of the application. This is useful for preventing unnecessary processing of configuration or library code in the case that an OAuth style authentication redirect is needed, or an erroneous condition will prevent the app and initialization should be completely aborted.

allLibrariesLoaded

allLibrariesLoaded: boolean

Indicates whether or not all libraries have been loaded.

allowCrossDomainConfig

allowCrossDomainConfig: boolean

Whether or not configuration can be loaded from other domains. If this is set to true, the application proxy will be used.

behavior

behavior: BehaviorBase

behaviorRegistry

behaviorRegistry: BehaviorRegistry

An instance of {@link behaviors.BehaviorRegistry} used to manage behaviours. See {@link behaviors.Behavior}.

command

commandRegistry

commandRegistry: CommandRegistry

An instance of {@link commands.CommandRegistry} used to manage and invoke named commands. See {@link commands.Command}.

configModel

configModel: ConfigurationModel

The object used to provide the application with configuration, if specified.

configPreprocessor

configPreprocessor: function

An optional configuration preprocessor - a function to process the configuration in place before parsing and loading. After initialization, this is nulled out.

Type declaration

    • (configObject: any): void
    • Parameters

      • configObject: any

      Returns void

configTokens

configTokens: object

Named configuration tokens for injection into JSON configuration. In configuration, tokens are wrapped by brackets like so:

{{TokenKey}}

When the application processes configuration, it will populate these token values according to the name/value pairs in configTokens. Note that configuration tokens can only be used as JSON values and not keys.

"siteUri": "sites/{{SiteName}}"

Type declaration

  • [key: string]: string

configUri

configUri: string

The URI of a JSON configuration block that was used to intialize the application, if it was specified.

configuration

configuration: ApplicationJson

Application-wide configuration available to all components. This is defined in the application section of configuration.

debugMode

debugMode: string | boolean

Whether or not the app is in "debug mode", enabling arbitrary debug functionality. Setting debugMode to true in basic Framework applications will cause the data-binding engine to leave data-binding statements in the DOM (for inspection purposes). Additional granuality can be provided by providing a text value along with the URL parameter. Current supported modes are 'gvh','event','command' and 'view'. These can be concatenated in a string, or use 'debugMode=all' to turn everything on.

developmentMode

developmentMode: boolean

Whether or not the application is in development/debug mode. When an application is in development mode, certain runtime behaviour may differ from when not in development mode. This is a somewhat abritrary flag in place as single, unified application flag.

event

eventRegistry

eventRegistry: EventRegistry

An instance of {@link events.EventRegistry} used to manage and dispatch named events. See {@link events.Event}.

host

host: string

The path of the hosted address of this application, not including the file portion, e.g. "http://localhost/my/app"

id

id: string

The ID of the application. This is used for keying application-wide resources, for example when using the {@link storage.Store} to store data. It should be a simple string key with no spaces or special characters.

initialStateAppliedCallback

initialStateAppliedCallback: function

Invoked when the initial state for all modules has been applied.

Type declaration

initializationCompleteCallback

initializationCompleteCallback: function

Invoked when the application has downloaded all libraries and finished initializing.

Type declaration

isHttpsMode

isHttpsMode: boolean

Whether or not the application was served via HTTPS.

isNative

isNative: Observable<boolean>

Indicates whether or not the application is functioning in some sort of enhanced native container, e.g. within some native application container or framework.

isOffline

isOffline: Observable<boolean>

Indicates whether or not the application is functioning in an offline mode. Setting this Observable changes the online/offline state of the application (for applications with offline capabilities).

isShuttingDown

isShuttingDown: boolean

Is the application in the middle of the shutdown process?

localServerAddress

localServerAddress: string

Indicates the address of the native layer, if the web app has been loaded within a GMAF instance

localServerNamespace

localServerNamespace: string

The namespace for accessing data for a particular app.

localServerToken

localServerToken: string

An access token which needs to be provided in order to access any of the local server endpoints.

locale

locale: string

The application's locale identifier. The application will attempt to pull a locale identifier from the navigator object if present. The locale can, by default, be overriden in the URL like so: index.html?locale=en-CA.

modalRegionSingleton

modalRegionSingleton: PopupModalRegionAdapter

An application-wide instance of a {@link ui.RegionAdapterBase} that creates and manages a modal popup.

moduleManager

moduleManager: ModuleManager

An instance of ModuleManager used to manage application modules.

proxyUri

proxyUri: string

An optional proxy URI to use.

shellName

shellName: "Desktop" | "Tablet" | "Handheld"

Name of the current shell

store

store: Store

A {@link geocortex.framework.storage.Store} to manage and facilitate storage of local data, particularly for offline use,.

trace

trace: Trace

The instance of a {@link geocortex.framework.utils.Trace} facility used by this application instance.

urlParameters

urlParameters: object

An object containing the URL parameters passed into the application.

Type declaration

  • [key: string]: string

version

version: string

The version of the app. Defaults to the primary version of Framework.js.

viewManager

viewManager: ViewManager

The {@link geocortex.framework.ui.ViewManager} instance used to manage hierarchies of regions and views.

Methods

Protected addNativeReadyFunction

  • addNativeReadyFunction(callback: function): void
  • Parameters

    • callback: function
        • (): void
        • Returns void

    Returns void

awaitModuleForView

  • awaitModuleForView(viewId: string): Promise<any>
  • Returns a promise that will be resolved when a module providing a particular view is loaded. If the module is loaded already the promise resolves immediately.

    Parameters

    • viewId: string

    Returns Promise<any>

awaitModules

  • awaitModules(moduleNames: string[]): Promise<any>
  • Wait for the specified collection of modules to load. Resolves immediately if the modules are loaded or do not exist.

    Parameters

    • moduleNames: string[]

    Returns Promise<any>

awaitModulesForCommand

  • awaitModulesForCommand(commandName: string): Promise<any>
  • Returns a promise that will be resolved when all deferred modules providing command fragments for a command are loaded. If all the modules are loaded already the promise resolves immediately.

    Parameters

    • commandName: string

    Returns Promise<any>

debugModeActive

  • debugModeActive(mode: string): boolean
  • Helper method to determine if a certain debug mode is currently active.

    Parameters

    • mode: string

      String representing the mode to check

    Returns boolean

fetchConfigResource

  • fetchConfigResource(args: object): any
  • Fetches a configuration resource, provided it comes from the same domain or a whitelisted domain.

    Parameters

    • args: object

      Arguments containing a URL to fetch. These will be passed directly into an XmlHttpRequest via dojo.xhrGet.

      • Optional error?: function
          • (param: any): void
          • Parameters

            • param: any

            Returns void

      • Optional load?: function
          • (param: any): void
          • Parameters

            • param: any

            Returns void

      • url: string

    Returns any

freeAllFrameworkObjects

  • freeAllFrameworkObjects(): void
  • Returns void

getFrameworkObjectById

  • System-wide method to get a FrameworkObject by ID.

    Parameters

    • id: any

      The ID of the object to fetch.

    Returns FrameworkObject

getFrameworkObjectByIdAsync

  • getFrameworkObjectByIdAsync(id: any, callback: function, errBack?: function): void
  • System-wide method to get a FrameworkObject by ID asynchronously whenever it's registered with this application

    Parameters

    • id: any

      The ID of the object to fetch.

    • callback: function
    • Optional errBack: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns void

getHostElement

  • getHostElement(): HTMLElement
  • Gets the container element of the application.

    Returns HTMLElement

Protected getInitialState

  • getInitialState(moduleName: string, libraryId: string): Thenable<any>
  • Subclasses can override this method to supply the initial state that will be applied to a module.

    Parameters

    • moduleName: string
    • libraryId: string

    Returns Thenable<any>

getLibraryOrder

  • getLibraryOrder(libraryId: string): number
  • Returns the order that a library has been configured in.

    Parameters

    • libraryId: string

      The ID of the library.

    Returns number

getResource

  • getResource(libraryId: string, key: string, locale?: string): string
  • Gets a language resource from the Application's resource dictionary, given a library ID, key, and optional locale. Returns null if the resource does not exist.

    Parameters

    • libraryId: string

      The ID of the library the resource is for.

    • key: string

      The resource key.

    • Optional locale: string

      The locale of the resource to fetch. Defaults to the current application locale.

    Returns string

getStashedLogs

  • getStashedLogs(): any[]
  • Return an array of stashed log. This is meant to be called one, since after it is called, it will stop stashing logs. This should be used by the log module.

    Returns any[]

getUri

  • getUri(uriPiece: string): string
  • Returns a URI, using the proxy if configured. Warns when mixed HTTP/HTTPS content is requested.

    todo

    Review if this is used anymore. May be time to deprecate it.

    Parameters

    • uriPiece: string

      A relative or absolute URI to format.

    Returns string

getUrlParameter

  • getUrlParameter(paramName: string): string
  • Returns the url parameter, ignoring case.

    Parameters

    • paramName: string

      The parameter to run a case insensitive search for and retrieve

    Returns string

    The url parameter if found, or null

hasDeferredModule

  • hasDeferredModule(moduleName: string): boolean
  • Given the name of a module that is not present, returns true if this is a module that could be loaded.

    Parameters

    • moduleName: string

    Returns boolean

hasLibrary

  • hasLibrary(libraryId: string): boolean
  • Does a library with this id exist?

    Parameters

    • libraryId: string

    Returns boolean

includeScript

  • includeScript(uri: string, successCallback: function, errorCallback: function): void
  • Includes and runs a script file. Called from '_loadTraditionalLibraries'

    Parameters

    • uri: string
    • successCallback: function

      The callback to fire if the script was successfully served via JSONP.

        • (script: string): void
        • Parameters

          • script: string

          Returns void

    • errorCallback: function

      The callback to fire if any error occurred trying to download the script.

        • (error: Error): void
        • Parameters

          • error: Error

          Returns void

    Returns void

initialize

  • initialize(): void
  • Begins the application initialization process.

    Returns void

injectLibraryResources

  • injectLibraryResources(libraryId: string, dictionary: object, locale: string): void
  • Adds the specified library resources for the specified library and locale to the application.

    Parameters

    • libraryId: string

      The ID of the library to inject resources for.

    • dictionary: object

      The dictionary of resources.

      • [key: string]: any
    • locale: string

      The locale of the resources.

    Returns void

instantiateFrameworkObject

  • instantiateFrameworkObject(typeName: string, libraryId: string): any
  • Instantiates a new FrameworkObject, passing in the application instance.

    Parameters

    • typeName: string

      The fully-qualified name of the type to instantiate.

    • libraryId: string

      The ID of the library that this object belongs to.

    Returns any

isHttpsUri

  • isHttpsUri(uri: string): boolean
  • Determines whether or not a URI is HTTPS by looking at the scheme.

    Parameters

    • uri: string

      The URI to test.

    Returns boolean

loadModulesForRegion

  • loadModulesForRegion(regionName: string): void
  • Loads all deferred modules that have views in the specified region that are configured visible. These views will auto-populate the region so there is no need to wait for them.

    Parameters

    • regionName: string

    Returns void

makeAbsolute

  • makeAbsolute(uri: string, appPathOverride?: any): string
  • Given a relative URI, returns an absolute URI based on the application's URI.

    Parameters

    • uri: string

      The relative URI to make absolute.

    • Optional appPathOverride: any

      Optional. Allows you to make the URI absolute using a different URI base.

    Returns string

notifyLibraryDownload

  • notifyLibraryDownload(libraryId: string): void
  • Called by the framework to notify the application that a library has been downloaded.

    Parameters

    • libraryId: string

      The ID of the library that has been downloaded.

    Returns void

onConfigurationLoaded

  • onConfigurationLoaded(configObject: any): void
  • Called immediately after the configuration object has been loaded from JSON, before any libraries have been downloaded.

    Parameters

    • configObject: any

    Returns void

pendingModulesForCommand

  • pendingModulesForCommand(commandName: string): string[]
  • Return the names of all modules that provide command fragments for this command, and which have not yet been loaded.

    Parameters

    • commandName: string

    Returns string[]

performTokenReplacement

  • performTokenReplacement(value: string): string
  • Takes a string with 0 or more tokens in it, and returns a string with the replacement tokens replaced.

    Parameters

    • value: string

      The string with the replacement tokens in it.

    Returns string

registerFrameworkObject

  • Registers a Framework.js object. Framework objects are registered against an Application for clean-up later.

    Parameters

    • obj: FrameworkObject

      The object to register. This object must have a unique ID.

    Returns FrameworkObject

shouldOmitStylesForLibrary

  • shouldOmitStylesForLibrary(libraryId: string): boolean
  • Tests whether a not a library should have its styles omitted.

    Parameters

    • libraryId: string

      The ID of the library in question.

    Returns boolean

shutdown

  • shutdown(state: any): void
  • Shuts down the application, releasing all modules, views, bindings, view models, regions, commands, and events.

    Parameters

    • state: any

      Custom state object, indicating a shutdown reason or exception.

    Returns void

Private translateConfiguration

  • translateConfiguration(libraryId: string, configuration: any): any
  • Translates configuration, substituting library-specific culture specific strings for the appropriate locale.

    Parameters

    • libraryId: string

      The ID of the library that the module configuration belongs to.

    • configuration: any

      The configuration to translate.

    Returns any

waitUntilAllLibrariesLoaded

  • waitUntilAllLibrariesLoaded(): Promise<void>
  • Returns a promise that is fulfilled when all the libraries are loaded.

    Returns Promise<void>

waitUntilShellStabilized

  • waitUntilShellStabilized(): Promise<void>
  • Returns a promise that is fulfilled when the 'shell' is stabilized. Note that the shell might not exist, but we still need to resolve this at a time, so we'll do it when the libraries load.

    Returns Promise<void>