Alertpal

Creation of the Alertpal Object

Source:

Methods

(static) alert(detailsopt)

Function to configure and display the 'alert' style Alertpal

Parameters:
Name Type Attributes Description
details object <optional>

Object to define the configuration of the alert (Optional - details of defaults below)

Properties
Name Type Attributes Description
title string <optional>

The title of the alert (Optional - default is 'Alert')

description string <optional>

The description of the alert. String can also include HTML for formatting (Optional - default is no description)

cancel string <optional>

The text inside the cancel button (Optional - default is 'Return')

cancelCallback function <optional>

Callback function to trigger when the cancel button is pressed (Option - default is closing the alert box)

Source:
Example
const config = {
  title: 'New alert',
  description: 'This is a alert pop up',
  cancel: 'Go back',
	 cancelCallback: returnToPage
};

Alertpal.alert(config);

(static) confirm(details)

Function to configure and display the 'confirm' style Alertpal

Parameters:
Name Type Description
details object

Object to define the configuration of the confirm

Properties
Name Type Attributes Description
title string <optional>

The title of the alert (Optional - default is 'Alert')

description string <optional>

The description of the alert. String can also include HTML for formatting (Optional - default is no description)

cancel string <optional>

The text inside the cancel/return button (Optional - default is 'Return')

ok string <optional>

The text inside the the ok button (Option - default is 'OK')

okCallback function

The callback you want to be triggered when the ok button is clicked

Source:
Example
const config = {
  title: 'Delete Item',
  description: 'Are you sure you want to delete this item?',
  cancel: 'No',
  ok: 'Yes',
  okCallback: deleteItemFunction
};

Alertpal.confirm(config);

(static) message(typeopt, detailsopt)

Function to configure and display the 'message' style Alertpals

Parameters:
Name Type Attributes Description
type string <optional>

Define what type of message 'normal' / 'success' / 'warn' / 'error' (Optional - default is 'normal')

details object <optional>

Object to define the configuration of the alert (Optional - details of defaults below)

Properties
Name Type Attributes Description
message string <optional>

The message for the alert (Optional - default is 'Alert')

timeout number <optional>

The time(milliseconds) on how long the alert should stay on screen (Optional - default is 5 seconds)

callback function <optional>

The callback to be triggered if click is fired on the message (Optional - default is to remove the message)

Source:
Example
const config = {
  message: 'Warning, you cant do that!',
  timeout: 10000
};

Alertpal.message('warn', config);

(static) modal(detailsopt)

Function to configure and display the 'alert' style Alertpal

Parameters:
Name Type Attributes Description
details object <optional>

Object to define the configuration of the alert (Optional - details of defaults below)

Properties
Name Type Attributes Description
title string <optional>

The title of the alert (Optional - default is 'Alert')

description string <optional>

The description of the alert. String can also include HTML for formatting (Optional - default is no description)

cancel string <optional>

The text inside the cancel button (Optional - default is 'Return')

ok string <optional>

The text inside the the ok button (Option - default is 'OK')

okCallback function <optional>

The callback you want to be triggered when the ok button is clicked (Optional - default is no action)

Source:
Example
const config = {
  title: 'Read the rules of the Application',
  description: 'Rules...',
  cancel: 'Decline',
  ok: 'Accept',
  okCallback: acceptFunction
};

Alertpal.modal(config);