LiaDevelopers

SDK reference

Questions, popups, alerts and toasts in Lia's own style, over your app.

Dialogs open over your app in Lia's own style and language direction, and pause your app while they're open. One of Lia's screens shows at a time: while one is open, another fails with busy.

#Lia.confirm(options)

A yes or no question in Lia's own sheet.

JavaScript
const { confirmed } = await Lia.confirm({
  title: "Start a new round?",
  body: "Your score so far won't count.",
  confirm: "Start over",
  danger: true,
});
OptionType
titlestringRequired, up to 60 characters.
bodystringOptional, up to 300 characters.
confirmstringOptional label for the yes button, up to 24 characters. Lia's own word when left out.
dangerbooleanOptional. Shows the yes button as destructive.

Resolves with { confirmed }, false however the sheet was closed without a yes. Errors: bad_title, bad_body, bad_confirm, busy.

#Lia.showPopup(params)

A message with up to three buttons. Resolves with the pressed button's id, or null if it was closed another way.

JavaScript
const choice = await Lia.showPopup({
  title: "Save your game?",
  message: "You can come back to it later.",
  buttons: [
    { id: "save", type: "default", text: "Save" },
    { id: "delete", type: "destructive", text: "Delete" },
    { type: "cancel" },
  ],
});
ParamType
titlestringOptional, up to 64 characters.
messagestringRequired, up to 256 characters.
buttonsarray1 to 3 buttons. One Close button when left out.

Each button:

FieldType
idstringWhat showPopup resolves with when it's pressed. Up to 64 characters; "" when left out.
typestring"default", "ok", "close", "cancel" or "destructive".
textstringRequired for default and destructive, up to 64 characters. The others use Lia's own word when left out.

Errors: bad_message, bad_title, bad_buttons, bad_button_type, bad_text, bad_id, busy.

#Lia.showAlert(message)

A message with one Close button. Resolves with nothing once it's closed.

JavaScript
await Lia.showAlert("Your progress is saved.");

#Lia.showConfirm(message)

A message with OK and Cancel. Resolves with true when OK was pressed.

JavaScript
if (await Lia.showConfirm("Leave this match?")) leaveMatch();

#Lia.toast(message, options)

A short message in Lia's own style that goes away by itself. It doesn't pause your app.

JavaScript
Lia.toast("Saved");
Lia.toast("No connection", { tone: "error", position: "top" });
ParameterType
messagestringUp to 140 characters.
options.positionstring"bottom" (the default) or "top".
options.tonestring"info" (the default) or "error".

Resolves with null. Errors: bad_text, bad_position.

Type to search every page, method and endpoint.