Class: LiferayApp

LiferayApp()

LiferayApp Inherits from `senna/src/app/App` and adds the following Liferay specific behavior to Senna's default App:
  • Makes cache expiration time configurable from System Settings
  • Lets you set valid status codes (Liferay's default valid status codes are listed in ServletResponseConstants.java)
  • Shows alert notifications when requests take too long or when they fail
  • Adds a portletBlacklist option that lets you exclude specific portlets from the SPA lifecycle.

Methods

_clearLayoutData()

Clears and detaches event handlers for Liferay's `dataLayoutConfigReady` event
Source:

_clearRequestTimer()

Clears the timer that notifies the user when the SPA request takes longer than the thresshold time configured in the `Liferay.SPA.userNotification.timeout` System Settings property
Source:

_createNotification(configurationnon-null) → (non-null) {Promise}

Creates a user notification
Parameters:
Name Type Description
configuration Object object that's passed to `Liferay.Notification`
Source:
Returns:
A promise that renders a notification when resolved
Type
Promise

_hideTimeoutAlert()

Hides the request timeout alert
Source:

_startRequestTimer(pathnon-null)

Starts the timer that shows the user a notification when the SPA request takes longer than the threshold time configured in the `Liferay.SPA.userNotification.timeout` System Settings property
Parameters:
Name Type Description
path String The path that may time out
Source:

createScreenInstance(pathnon-null) → {Screen}

Retrieves or create a screen instance to a path. This method overrides the default one to avoid ActionURLScreens to be cached and reused across navigations causing different lifecycle mechanisms to be called on live documents instead of on inert fragments
Parameters:
Name Type Description
path string Path containing the querystring part.
Source:
Returns:
Type
Screen

getCacheExpirationTime() → (non-null) {Number}

Returns the cache expiration time configuration. This value comes from System Settings. The configuration is set upon App initialization
Source:
See:
Returns:
The `cacheExpirationTime` value
Type
Number

getValidStatusCodes() → (non-null) {Array}

Returns the valid status codes accepted by Liferay. These values come from ServletResponseConstants.java.
Source:
Returns:
The `validStatusCodes` property
Type
Array

isCacheEnabled() → (non-null) {Boolean}

Returns whether the cache is enabled. Cache is considered enabled when getCacheExpirationTime is greater than zero.
Source:
Returns:
True if cache is enabled
Type
Boolean

isInPortletBlacklist(elementnon-null) → (non-null) {Boolean}

Returns whether a given portlet element is in a blacklisted portlet that should not behave like a SPA
Parameters:
Name Type Description
element String The portlet boundary DOM node
Source:
Returns:
True if portlet element is blacklisted
Type
Boolean

isScreenCacheExpired(screennon-null) → (non-null) {Boolean}

Returns whether a given Screen's cache is expired. The expiration timeframe is based on the value returned by getCacheExpirationTime.
Parameters:
Name Type Description
screen Screen The Senna Screen
Source:
Returns:
True if the cache has expired
Type
Boolean

onBeforeNavigate(datanon-null, eventnon-null)

A callback for Senna's `beforeNavigate` event. The cache is cleared for all screens when the flag `Liferay.SPA.clearScreensCache` is set or when a form submission is about to occur. This method also exposes the `beforeNavigate` event to the Liferay global object so anyone can listen to it.
Parameters:
Name Type Description
data Object Data about the event
event Event The event object
Source:

onDataLayoutConfigReady_(eventnon-null)

A private event handler function, called when the `dataLayoutConfigReady` event is fired on the Liferay object, that initializes `Liferay.Layout`
Parameters:
Name Type Description
event Event The event object
Source:

onDocClickDelegate_(eventnon-null)

Parameters:
Name Type Description
event Event The event object
Source:

onDocSubmitDelegate_(eventnon-null)

Parameters:
Name Type Description
event Event The event object
Source:

onEndNavigate(eventnon-null)

Callback for Senna's `endNavigate` event that exposes it to the Liferay global object
Parameters:
Name Type Description
event Event The event object
Source:

onLiferayIOComplete()

Callback for Liferay's `io:complete` event that clears screens cache when an async request occurs
Source:

onNavigationError(eventnon-null)

Callback for Senna's `navigationError` event that displays an alert message to the user with information about the error
Parameters:
Name Type Description
event Event The event object
Source:

onStartNavigate(eventnon-null)

Callback for Senna's `startNavigate` event that exposes it to the Liferay global object
Parameters:
Name Type Description
event Event The event object
Source:

setPortletsBlacklist(portletsBlacklistnon-null)

Sets the `portletsBlacklist` property
Parameters:
Name Type Description
portletsBlacklist Object
Source:

setValidStatusCodes(validStatusCodesnon-null)

Sets the `validStatusCodes` property
Parameters:
Name Type Description
validStatusCodes Array
Source:

updateHistory_()

Source: