Class: Application

Application()

Application is a nexus that provides many routing and global application services that may be used from anywhere within the app. It provides a shortcut alias to `window.App` (`App`) with the most common usage being `App.getView(id)`.

Constructor

new Application()

Source:

Members

applicationmenu

Instance of SoHo Xi applicationmenu.
Source:

bars

Toolbar instances by key name
Properties:
Type Description
Object
Source:

currentOrientation

Properties:
Name Type Description
Current String orientation of the application. Can be landscape or portrait.
Source:

defaultService

The default Sage.SData.Client.SDataService instance
Properties:
Type Description
Object
Source:

enableConcurrencyCheck

Properties:
Name Type Description
enableConcurrencyCheck Boolean Option to skip concurrency checks to avoid precondition/412 errors.
Source:

maxUploadFileSize

Signifies the maximum file size that can be uploaded in bytes
Properties:
Type Description
int
Source:

ModelManager

All options are mixed into App itself
Source:

PING_DEBOUNCE

Ping debounce time.
Source:

PING_RETRY

Number of times to attempt to ping.
Source:

PING_TIMEOUT

Timeout for the connection check.
Source:

redirectHash

The hash to redirect to after login.
Properties:
Type Description
String
Source:

viewSettingsModal :Modal

Instance of SoHo Xi modal dialog for view settings. This was previously in the right drawer.
Type:
  • Modal
Source:

viewShowOptions

Properties:
Name Type Description
viewShowOptions Array Array with one configuration object that gets pushed before showing a view. Allows passing in options via routing. Value gets removed once the view is shown.
Source:

Methods

_initAppStateSequence({index), {sequences))

Process a app state sequence and start the next sequnce when done.
Parameters:
Name Type Description
{index) the index of the sequence to start
{sequences) an array of sequences
Source:

_ping()

Returns a promise. The results are true of the resource came back before the PING_TIMEOUT. The promise is rejected if there is timeout or the response is not a 200 or 304.
Source:

_startupConnections()

Establishes various connections to events.
Source:

activate()

Sets the global variable `App` to this instance.
Source:

destroy()

Loops through and disconnections connections and unsubscribes subscriptions. Also calls uninitialize.
Source:

filterNavigationContext(predicate, scope) → {Array}

Searches App.context.history by passing a predicate function that should return true if a match is found, false otherwise. This is similar to queryNavigationContext, however, this function will return an array of found items instead of a single item.
Parameters:
Name Type Description
predicate function
scope Object
Source:
Returns:
context history filtered out by the predicate.
Type
Array

getContainerNode()

Returns the dom associated to the container element.
Deprecated:
  • Yes
Source:

getCurrentPage() → {DOMNode}

Gets the current page(domNode)
Source:
Returns:
Type
DOMNode

getCustomizationsFor(path)

Returns the customizations registered for the provided path. Note: This also accepts the legacy signature: `getCustomizationsFor(set, id)` Where the path is `list/tools` and `id` is the view id
Parameters:
Name Type Description
path String The customization set such as `list/tools#account_list` or `detail#contact_detail`. First half being the type of customization and the second the view id.
Source:

getPrimaryActiveView() → {View}

Gets the current page and then returns the result of getView(name).
Source:
Returns:
Returns the active view instance, if no view is active returns null.
Type
View

getService(name) → {Object}

Returns the registered SDataService instance by name, or returns the default service.
Parameters:
Name Type Description
name String/Boolean If string service is looked up by name. If false, default service is returned.
Source:
Returns:
The registered Sage.SData.Client.SDataService instance.
Type
Object

getView(key) → {View}

Returns the registered view instance with the associated key.
Parameters:
Name Type Description
key String/Object The id of the view to return, if object then `key.id` is used.
Source:
Returns:
view The requested view.
Type
View

getViews() → {Array.<View>}

Returns all the registered views.
Source:
Returns:
An array containing the currently registered views.
Type
Array.<View>

getViewSecurity(key, access)

Returns the defined security for a specific view
Parameters:
Name Type Description
key String Id of the registered view to query.
access
Source:

hasConnection(name)

Determines the the specified service name is found in the Apps service object.
Parameters:
Name Type Description
name String Name of the SDataService to detect
Source:

hasService(name)

Determines the the specified service name is found in the Apps service object.
Parameters:
Name Type Description
name String Name of the SDataService to detect
Source:

hasView(key) → {Boolean}

Determines if any registered view has been registered with the provided key.
Parameters:
Name Type Description
key String Unique id of the view.
Source:
Returns:
True if there is a registered view name matching the key.
Type
Boolean

init()

Initializes this application as well as the toolbar and all currently registered views.
Source:

initAppState() → {Promise}

Executes the chain of promises registered with registerAppStatePromise. When all promises are done, a new promise is returned to the caller, and all registered promises are flushed. Each app state can be processed all at once or in a specfic seqence. Example: We can register App state seqeunces as the following, where each sequence is proccessed in a desending order form 0 to n. The first two in this example are defeulted to a sequence of zero (0) and are procced first in which after the next sequence (1) is proccessed and once all of its items are finshed then the last sequence 2 will start and process all of its items. If two seqences have the same number then thay will get combinded as if they where registerd together. Aso not all items whith in a process are processed and ansync of each other and may not finish at the same time. To make two items process one after the other simpley put them in to diffrent sequences. this.registerAppStatePromise(() => {some functions that returns a promise}); this.registerAppStatePromise(() => {some functions that returns a promise}); this.registerAppStatePromise({ seq: 1, description: 'Sequence 1', items: [{ name: 'itemA', description: 'item A', fn: () => { some functions that returns a promise }, }, { name: 'itemb', description: 'Item B', fn: () => {some functions that returns a promise}, }], }); this.registerAppStatePromise({ seq: 2, description: 'Sequence 2', items: [{ name: 'item C', description: 'item C', fn: () => { some functions that returns a promise }, }, }); There are there App state seqences re
Source:
Returns:
Type
Promise

initConnects()

Establishes various connections to events.
Source:

initHash()

Initialize the hash and save the redirect hash if any
Source:

initModules()

Loops through modules and calls their `init()` function.
Source:

initModulesDynamic()

Loops through modules and calls their `initDynamic()` function.
Source:

initServices()

Loops through connections and calls registerService on each.
Source:

initToolbars()

Loops through (tool)bars and calls their `init()` function.
Source:

isNavigationFromResourceKind(kind, predicate, scope) → {Object}

Shortcut method to queryNavigationContext that matches the specified resourceKind provided
Parameters:
Name Type Description
kind Array.<String/String> The resourceKind(s) the history item must match
predicate function Optional. If provided it will be called on matches so you may do an secondary check of the item - returning true for good items.
scope Object Scope the predicate should be called in.
Source:
Returns:
context History data context if found, false if not.
Type
Object

isOnFirstView() → {boolean}

Returns true/false if the current view is the first/initial view. This is useful for disabling the back button (so you don't hit the login page).
Source:
Returns:
Type
boolean

isOnline()

Returns the `window.navigator.onLine` property for detecting if an internet connection is available.
Source:

isViewActive(view) → {Boolean}

Checks to see if the passed view instance is the currently active one by comparing it to primaryActiveView.
Parameters:
Name Type Description
view View
Source:
Returns:
True if the passed view is the same as the active view.
Type
Boolean

onResize()

Resize handle
Source:

queryNavigationContext(predicate, depth, scope) → {Object/Boolean}

Searches App.context.history by passing a predicate function that should return true when a match is found.
Parameters:
Name Type Description
predicate function Function that is called in the provided scope with the current history iteration. It should return true if the history item is the desired context.
depth Number
scope Object
Source:
Returns:
context History data context if found, false if not.
Type
Object/Boolean

registerAppStatePromise(promise)

Registers a promise that will resolve when initAppState is invoked.
Parameters:
Name Type Description
promise Promise | function A promise or a function that returns a promise
Source:

registerConnection(name, definition, options)

Optional creates, then registers an Sage.SData.Client.SDataService and adds the result to `App.services`.
Parameters:
Name Type Description
name String Unique identifier for the service.
definition Object May be a SDataService instance or constructor parameters to create a new SDataService instance.
options Object Optional settings for the registered service.
Source:

registerCustomization(path, spec)

Registers a customization to a target path. A Customization Spec is a special object with the following keys: * `at`: `function(item)` - passes the current item in the list, the function should return true if this is the item being modified (or is at where you want to insert something). * `at`: `{Number}` - May optionally define the index of the item instead of a function. * `type`: `{String}` - enum of `insert`, `modify`, `replace` or `remove` that indicates the type of customization. * `where`: `{String}` - enum of `before` or `after` only needed when type is `insert`. * `value`: `{Object}` - the entire object to create (insert or replace) or the values to overwrite (modify), not needed for remove. * `value`: `{Object[]}` - if inserting you may pass an array of items to create. Note: This also accepts the legacy signature: `registerCustomization(path, id, spec)` Where the path is `list/tools` and `id` is the view id All customizations are registered to `this.customizations[path]`.
Parameters:
Name Type Description
path String The customization set such as `list/tools#account_list` or `detail#contact_detail`. First half being the type of customization and the second the view id.
spec Object The customization specification
Source:

registerService(name, service, options)

Optional creates, then registers an Sage.SData.Client.SDataService and adds the result to `App.services`.
Parameters:
Name Type Description
name String Unique identifier for the service.
service Object May be a SDataService instance or constructor parameters to create a new SDataService instance.
options Object Optional settings for the registered service.
Source:

registerToolbar(name, tbar, domNode)

Registers a toolbar with the application and renders it to HTML. If the application has already been initialized, the toolbar is immediately initialized as well.
Parameters:
Name Type Description
name String Unique name of the toolbar
tbar Toolbar Toolbar instance to register
domNode domNode Optional. A DOM node to place the view in.
Source:

registerView(view, domNode)

Registers a view with the application and renders it to HTML. If the application has already been initialized, the view is immediately initialized as well.
Parameters:
Name Type Description
view View A view instance to be registered.
domNode domNode Optional. A DOM node to place the view in.
Source:

run()

Sets `_started` to true.
Source:

setCurrentPage(_page)

Sets the current page(domNode)
Parameters:
Name Type Description
_page DOMNode
Source:

setPrimaryTitle(title)

Sets the applications current title.
Parameters:
Name Type Description
title String The new title.
Source:

showLeftDrawer()

Override this function to load a view in the left drawer.
Source:

showRightDrawer()

Override this function to load a view in the right drawer.
Source:

supportsTouch() → {Boolean}

Check if the browser supports touch events.
Source:
Returns:
true if the current browser supports touch events, false otherwise.
Type
Boolean

uninitialize()

Shelled function that is called from destroy, may be used to release any further handles.
Source: