TComponents. Popup_A

Members

(static) CANCEL :string

'cancel'

Type:
  • string

(static) OK :string

'ok'

Type:
  • string

(static) cancel

'cancel'

(static) ok

'ok'

Deprecated

enabled

show

Methods

asyncConfirm(header, message, options) → {Promise.<string>}

A popup dialog with async callback support. The popup will only close after the callback execution completes.

Parameters:
NameTypeDescription
headerstring

A string, describing the header of the popup.

messagestring | Array.<string>

The message content. Can be a string or an array of strings.

optionsObject

Configuration options

Properties
NameTypeAttributesDefaultDescription
confirmTextstring<optional>
'OK'

Text for the confirm button

cancelTextstring<optional>
'Cancel'

Text for the cancel button

onConfirmfunction<optional>

Async function to execute when confirm button is clicked

onCancelfunction<optional>

Function to execute when cancel button is clicked

stylestring<optional>

Popup style: 'information', 'warning', or 'danger'

Returns:

Returns the action ('ok' or 'cancel')

Type: 
Promise.<string>
Example
await TComponents.Popup_A.asyncConfirm(
  'Confirm Operation',
  ['This will perform an async operation.', 'Do you want to continue?'],
  {
    confirmText: 'Execute',
    cancelText: 'Cancel',
    onConfirm: async (action) => {
      await someAsyncOperation();
      console.log('Operation completed');
    },
    style: 'information'
  }
);

confirm(msg1, msg_arrayopt, callbackopt)

A popup dialog is a modal window that provides "OK/Cancel" confirmation dialog.

Parameters:
NameTypeAttributesDescription
msg1string

A string, describing the topic of the message.

msg_arraystring | Array.<string><optional>

The actual message. It can be either a simple string or, if several lines are required, an array where each element is a string with a message line.

callbackfunction<optional>

A function that will be called when the user dismisses by pressing the 'OK' or 'Cancel' button.

Example
TComponents.Popup_A.confirm(
  `XXX module not yet loaded on the controller`,
  ['This module is required for this WebApp.', 'Do you want to load the module?'],
  (action) => {
   if (action === 'ok') {
     console.log("Load the module here...")
   } else if (action == 'cancel') {
     console.log("Abort mission!");
   }
 }
);

danger(msg1, msg_arrayopt, callbackopt)

A popup dialog is a modal window that provides the user with danger messages.

Parameters:
NameTypeAttributesDescription
msg1string

A string, describing the topic of the message.

msg_arraystring | Array.<string><optional>

The actual message. It can be either a simple string or, if several lines are required, an array where each element is a string with a message line.

callbackfunction<optional>

A function that will be called when the user dismisses by pressing the 'OK' or 'Cancel' button.

Example
try {
   // do something
 } catch (e) {
   TComponents.Popup_A.danger('Something went wrong', [e.message, e.description]);
 }

error(e)

A popup dialog is a modal window that provides the user with error messages.

Parameters:
NameTypeDescription
eobject

Error object for example, errorthrown by Omnicore RWS

To Do
  • Optimize the parsing of error object
Example
try {
   throw new Error("Whoops!");
 } catch (e) {
   TComponents.Popup_A.error(e, 'Custom title');
 };

info(msg1, msg_arrayopt, callbackopt)

A popup dialog is a modal window that provides the user with information messages. The main difference from the Popup_A.message is that Popup_A.info includes an "i" image in the modal window.

Parameters:
NameTypeAttributesDescription
msg1string

A string, describing the topic of the message.

msg_arraystring | Array.<string><optional>

The actual message. It can be either a simple string or, if several lines are required, an array where each element is a string with a message line.

callbackfunction<optional>

A function that will be called when the user dismisses by pressing the 'OK' or 'Cancel' button.

Example
TComponents.Popup_A.info(
  "Important information!",
  [
    "For your information, this is a popup dialog.",
    "",
    "Further information can be given here!"
  ],
 function (action) {
   console.log("OK button was clicked")
 });

message(msg1, msg_arrayopt, callbackopt)

A popup dialog is a modal window that provides the user with information messages.

Parameters:
NameTypeAttributesDescription
msg1string

A string, describing the topic of the message.

msg_arraystring | Array.<string><optional>

The actual message. It can be either a simple string or, if several lines are required, an array where each element is a string with a message line.

callbackfunction<optional>

A function that will be called when the user dismisses by pressing the 'OK' or 'Cancel' button.

Example
TComponents.Popup_A.message(
  "Important message!",
  [
    "For your information, this is a popup dialog.",
    "",
    "Further information can be given here!"
  ],
 function (action) {
   console.log("OK button was clicked")
 });

warning(msg1, msg_arrayopt, callbackopt)

A popup dialog is a modal window that provides the user with warning messages.

Parameters:
NameTypeAttributesDescription
msg1string

A string, describing the topic of the message.

msg_arraystring | Array.<string><optional>

The actual message. It can be either a simple string or, if several lines are required, an array where each element is a string with a message line.

callbackfunction<optional>

A function that will be called when the user dismisses by pressing the 'OK' or 'Cancel' button.

Example
try {
   // do something
 } catch (e) {
   Popup_A.waring('Something went wrong', [e.message, e.description]);
 }