Class: Common

Common

App Enablement class for all common used functionalities like registering and unregistering to events and to get the session context.

new Common()

Since:
  • 2.0.0
Author:
  • mluzius

Methods


<static> closeBrowser()

This function will close the app

Since:
  • 2.1.0
Author:
  • nmankel (Last modified by: nmankel)

<static> createRegisterListenerRequest(sEventName, sEventListenerName, bPassData)

This function will create a request object for the function 'registerListener'.

Parameters:
Name Type Description
sEventName string Name of the event that should be registered. For example: 'EVENT_TRANSACTION_UPDATED'.
sEventListenerName string Name of the event listener function that should be executed when the event is fired.
bPassData boolean Flag to indicate if the event listener function receives a data parameter. For example needed for Scan events to provide the barcodeFormat and the rawScanData.
Since:
  • 2.0.0
Author:
  • mluzius (Last modified by: mluzius)
Returns:
(String) Returns a stringified Object for the registerListener request.

<static> createUnregisterListenerRequest(sEventName, sEventListenerName)

This function will create a request object for the function 'unregisterListener'.

Parameters:
Name Type Description
sEventName string Name of the event that should be unregistered. For example: 'EVENT_TRANSACTION_UPDATED'.
sEventListenerName string Name of the event listener function that should be unregistered.
Since:
  • 2.0.0
Author:
  • mluzius (Last modified by: mluzius)
Returns:
(String) Returns a stringified Object for the unregisterListener request.

<static> getOperatorData(sResultFunction, sErrorFunction)

This function will provide operator data. For example operatorID, name, rights.

The internally returned object looks like the following example: { operatorID: "1", workerID: "1", salutation: "Herr", firstName: "Max", lastName: "Mustermann", rightsSet: ["S.00000000001.00","S.00000000001.01"], }
Parameters:
Name Type Description
sResultFunction string Name of the success callback function. Data type is string but internal data type is function.
sErrorFunction string Name of the error callback function. Data type is string but internal data type is function.
Since:
  • 2.1.0
Author:
  • nmankel (Last modified by: nmankel)

<static> getSessionContext(sResultFunction, sErrorFunction)

This function will provide the session context. For example currency, language.

The internally returned object looks like the following example: { businessUnitGroupID: "100000000000000001", businessUnitID: "9090", // Equivalent to store ID isoCurrencyCode: "USD", storeLanguage: "en_US", tenantID: "004", userLanguage: "zh_CN", workstationID: "107" }
Parameters:
Name Type Description
sResultFunction string Name of the success callback function. Data type is string but internal data type is function.
sErrorFunction string Name of the error callback function. Data type is string but internal data type is function.
Since:
  • 2.0.0
Author:
  • mluzius (Last modified by: mluzius)

<static> hideBrowser()

This function will hide the app

Since:
  • 2.1.0
Author:
  • nmankel (Last modified by: nmankel)

<static> registerListener(oRegisterListenerRequest)

This function will register a listener for the given event.

Parameters:
Name Type Description
oRegisterListenerRequest string Necessary request object to register event listeners. Data type is string but internal data type is Object. The internally used object should look like the following example: { "event": "EVENT_TRANSACTION_UPDATED", "listener": "returnEventNotification", "passData": false || true }
Since:
  • 2.0.0
Author:
  • mluzius (Last modified by: mluzius)

<static> unregisterListener(sUnregisterListenerRequest)

This function will unregister a listener for the given event.

Parameters:
Name Type Description
sUnregisterListenerRequest string Name of the event that should be unregistered so that it can't be fired any longer. Data type is string but internal data type is Object.
Since:
  • 2.0.0
Author:
  • mluzius (Last modified by: mluzius)