lart.appLock

App locking state management.

The lart.appLock namespace provides functionality for the management of the app’s global lock state. The lock state is used to optionally enable or disable certain functionality in the UI, such as the user’s ability to open the right-click context menu. Generally, the functionality that is made dependent on the lock state should only include that functionality which may be inadvertently used by a user during a task that could corrupt the responses collected for that task (e.g. by right clicking they could reload, resubmit, inspect the source logic, etc.).

Attributes

lart.appLock.state

type: string

The app’s current global lock state.

This will be either the string ‘locked’ or the string ‘unlocked’.

You should never set the app’s lock state manually by manipulating this variable. Instead use the {@link lart.appLock.lock} and {@link lart.appLock.unlock} functions to set the app’s lock state.

lart.appLock.switches

type: Set

Set holding references to HTMLElements that should reflect the app’s global lock state.

Use {@link lart.appLock.registerSwitch} to register HTMLElements that should be switched along with the app’s global lock state.

Functions

static lart.appLock._contextMenuHandler(event)

Simple event handler to prevent default behaviour when the context menu is triggered.

Arguments:
  • event (Event) – The context menu triggering event.

static lart.appLock._setSwitchState(element)

Sets the innerHTML of an HTMLElement according to the current switch state.

Arguments:
  • element (HTMLElement)

static lart.appLock.lock()

Set app’s lock state to locked.

Returns:

null

static lart.appLock.registerSwitch(switchElementOrId, eventType)

Register an HTMLElement to be switched over on changes to the app’s global lock state.

Arguments:
  • switchElementOrId (HTMLElement|string)

  • eventType (string)

Returns:

null

static lart.appLock.toggleState()

Toggle the app’s lock status, irrespective of its current state.

Calling this function will set the app’s global lock state to unlocked if it is currently locked, and it will set it to locked if it is currently unlocked.

Returns:

null

static lart.appLock.unlock()

Set app’s global state to unlocked.

Returns:

null