Namespace: dialog

dialog

Manage the dialog window of AskiaPortal.

 portal.dilalog.prompt({
     title: "Give me your age"
     message : "Please enter your age in the box belox:",
     input: "number",
     placeholder: "18-99",
     buttons: {
         ok : {
             text: "Save my age"
         },
         cancel: {
             text: "Dont't save my age"
         }
     }
 }).then((resuit) => {

     portal.dialog.alert({
         message: (result.button === "ok") ? `You said you have ${result.value}`: "You don't want to give your age" 
     });

 });
Dependencies:
  • ./js/portal.channel.js

Methods

(static) alert(config) → {Promise}

Display the 'alert' window dialog

Parameters:
Name Type Description
config Object

Config of the dialog window

Properties
Name Type Attributes Description
title String <optional>

Title of the dialog window

buttons Object <optional>

Config of the dialog buttons

Properties
Name Type Attributes Description
ok String <optional>

Config of the dialog "ok" button

Properties
Name Type Attributes Description
text String <optional>

Text of the dialog "ok" button

title String <optional>

Title of the dialog "ok" button

danger Boolean <optional>

Use the "danger" style for the "ok" button

message String

Message to display in the dialog window

Returns:
Type
Promise

(static) confirm(config) → {Promise}

Display the 'confirm' window dialog

Parameters:
Name Type Description
config Object

Config of the dialog window

Properties
Name Type Attributes Description
title String <optional>

Title of the dialog window

buttons Object <optional>

Config of the dialog buttons

Properties
Name Type Attributes Description
ok Object <optional>

Config of the dialog "ok" button

Properties
Name Type Attributes Description
text String <optional>

Text of the dialog "ok" button

title String <optional>

Title of the dialog "ok" button

danger Boolean <optional>

Use the "danger" style for the "ok" button

cancel Object <optional>

Config of the dialog "cancel" button

Properties
Name Type Attributes Description
text String <optional>

Text of the dialog "cancel" button

title String <optional>

Title of the dialog "cancel" button

no Object <optional>

Config of the dialog "no" button (if present it will activate it)

Properties
Name Type Attributes Description
text String <optional>

Text of the dialog "no" button

title String <optional>

Title of the dialog "no" button

message String

Message to display in the dialog window

Returns:
Type
Promise

(static) prompt(config) → {Promise}

Display the 'prompt' window dialog

Parameters:
Name Type Description
config Object

Config of the dialog window

Properties
Name Type Attributes Default Description
title String <optional>

Title of the dialog window

input String <optional>
"text"

Type of the input for the "prompt" dialog

value String <optional>
""

Initial input value for the "prompt" dialog

placeholder String <optional>
""

Input placeholder for the "prompt" dialog

buttons Object <optional>

Config of the dialog buttons

Properties
Name Type Attributes Description
ok Object <optional>

Config of the dialog "ok" button

Properties
Name Type Attributes Description
text String <optional>

Text of the dialog "ok" button

title String <optional>

Title of the dialog "ok" button

danger Boolean <optional>

Use the "danger" style for the "ok" button

cancel Object <optional>

Config of the dialog "cancel" button

Properties
Name Type Attributes Description
text String <optional>

Text of the dialog "cancel" button

title String <optional>

Title of the dialog "cancel" button

no Object <optional>

Config of the dialog "no" button (if present it will activate it)

Properties
Name Type Attributes Description
text String <optional>

Text of the dialog "no" button

title String <optional>

Title of the dialog "no" button

message String

Message to display in the dialog window

Returns:
Type
Promise

(static) show(config) → {Promise}

Display a dialog window from AskiaPortal

Parameters:
Name Type Description
config Object

Config of the dialog window

Properties
Name Type Attributes Default Description
title String <optional>

Title of the dialog window

type String <optional>
"alert"

Type of the dialog window ("alert", "prompt", "confirm")

input String <optional>
"text"

Type of the input for the "prompt" dialog

value String <optional>
""

Initial input value for the "prompt" dialog

placeholder String <optional>
""

Input placeholder for the "prompt" dialog

buttons Object <optional>

Config of the dialog buttons

Properties
Name Type Attributes Description
ok Object <optional>

Config of the dialog "ok" button

Properties
Name Type Attributes Description
text String <optional>

Text of the dialog "ok" button

title String <optional>

Title of the dialog "ok" button

danger Boolean <optional>

Use the "danger" style for the "ok" button

cancel Object <optional>

Config of the dialog "cancel" button

Properties
Name Type Attributes Description
text String <optional>

Text of the dialog "cancel" button

title String <optional>

Title of the dialog "cancel" button

no Object <optional>

Config of the dialog "no" button (if present it will activate it)

Properties
Name Type Attributes Description
text String <optional>

Text of the dialog "no" button

title String <optional>

Title of the dialog "no" button

message String

Message to display in the dialog window

Returns:
Type
Promise