Skip to content

Sys.App

Sys.App controls the running app in the End user’s browser: it shows notifications, reads and sets the browser page title, keeps a loading-spinner state, and lets the End user download or open generated files.

Availability: Client

showNotification(type: ClientLogLevel, message: string, autoClose?: boolean | number, tooltip?: string): void;

Shows a notification at the edge of the page, styled by its type.

ParameterTypeDescription
typeClientLogLevelKind of notification: 'success', 'error', 'warning' or 'info'.
messagestringText of the notification.
autoCloseboolean | numberOptional. true closes the notification after 2 seconds, a number closes it after that many milliseconds, and false keeps it open until the End user dismisses it. Default: true for 'success' and 'info', false for 'error' and 'warning'.
tooltipstringOptional. Tooltip text shown on the notification. Default: no tooltip.

Returns: void · Availability: Client

showError(error: any, autoClose?: boolean | number): void;

Shows an error notification and writes error to the browser console. The notification shows the error’s message property, or error itself if it has none.

ParameterTypeDescription
erroranyAn Error object or a message text.
autoCloseboolean | numberOptional. As in showNotification(). Default: stays open until dismissed.

Returns: void · Availability: Client

showSuccess(message: string, autoClose?: boolean | number): void;

Shows a success notification.

ParameterTypeDescription
messagestringText of the notification.
autoCloseboolean | numberOptional. As in showNotification(). Default: closes after 2 seconds.

Returns: void · Availability: Client

showWarning(message: string, autoClose?: boolean | number): void;

Shows a warning notification.

ParameterTypeDescription
messagestringText of the notification.
autoCloseboolean | numberOptional. As in showNotification(). Default: stays open until dismissed.

Returns: void · Availability: Client

showInfo(message: string, autoClose?: boolean | number): void;

Shows an info notification.

ParameterTypeDescription
messagestringText of the notification.
autoCloseboolean | numberOptional. As in showNotification(). Default: closes after 2 seconds.

Returns: void · Availability: Client

setTitle(title: string): void;

Sets the title of the browser page, as shown in the browser tab. Same as assigning the title property.

ParameterTypeDescription
titlestringThe new page title.

Returns: void · Availability: Client

getTitle(): string;

Returns the current title of the browser page. Same as reading the title property.

Returns: string · Availability: Client

provideDownload(content: any, fileName: string, mimeType?: string): void;

Hands content to the browser as a file download, so the End user can save it.

ParameterTypeDescription
contentanyFile content: a string, Blob, ArrayBuffer or typed array. Other values are converted to text.
fileNamestringName suggested to the End user for the downloaded file.
mimeTypestringOptional. MIME type of the file, for example 'text/csv'. Default: none.

Returns: void · Availability: Client

openDownloadInNewWindow(content: any, fileName: string, mimeType?: string): void;

Opens content as a file in a new browser tab, for example to show a PDF in the browser’s viewer.

ParameterTypeDescription
contentanyFile content: a string, Blob, ArrayBuffer or typed array. Other values are converted to text.
fileNamestringName of the file.
mimeTypestringOptional. MIME type of the file, for example 'application/pdf'. Pass it so the browser knows how to display the content.

The temporary link to the content stops working after 10 seconds, so the new tab must load it right away.

Returns: void · Availability: Client

get isSpinnerVisible(): boolean;
set isSpinnerVisible(value: boolean);

Whether the app is in its loading state. Setting it to true sets spinnerText to 'Loading...' if no text is set yet. Setting it to false clears spinnerText.

Note

Lowgile only keeps this state; it doesn’t show a spinner by itself. To show one, bind a Screen component to Sys.App.isSpinnerVisible or Sys.App.spinnerText.

Type: boolean · Availability: Client

set spinnerText(text: string | undefined);
get spinnerText(): string | undefined;

Text describing the current loading state, or undefined if the app is not loading. Setting any string, including '', makes isSpinnerVisible true; setting undefined makes it false.

Type: string \| undefined · Availability: Client

set title(title: string);
get title(): string;

The title of the browser page, as shown in the browser tab. Reading and assigning it is the same as calling getTitle() and setTitle().

Type: string · Availability: Client