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
Functions
Section titled “Functions”showNotification()
Section titled “showNotification()”showNotification(type: ClientLogLevel, message: string, autoClose?: boolean | number, tooltip?: string): void;Shows a notification at the edge of the page, styled by its type.
| Parameter | Type | Description |
|---|---|---|
type | ClientLogLevel | Kind of notification: 'success', 'error', 'warning' or 'info'. |
message | string | Text of the notification. |
autoClose | boolean | number | Optional. 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'. |
tooltip | string | Optional. Tooltip text shown on the notification. Default: no tooltip. |
Returns: void · Availability: Client
showError()
Section titled “showError()”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.
| Parameter | Type | Description |
|---|---|---|
error | any | An Error object or a message text. |
autoClose | boolean | number | Optional. As in showNotification(). Default: stays open until dismissed. |
Returns: void · Availability: Client
showSuccess()
Section titled “showSuccess()”showSuccess(message: string, autoClose?: boolean | number): void;Shows a success notification.
| Parameter | Type | Description |
|---|---|---|
message | string | Text of the notification. |
autoClose | boolean | number | Optional. As in showNotification(). Default: closes after 2 seconds. |
Returns: void · Availability: Client
showWarning()
Section titled “showWarning()”showWarning(message: string, autoClose?: boolean | number): void;Shows a warning notification.
| Parameter | Type | Description |
|---|---|---|
message | string | Text of the notification. |
autoClose | boolean | number | Optional. As in showNotification(). Default: stays open until dismissed. |
Returns: void · Availability: Client
showInfo()
Section titled “showInfo()”showInfo(message: string, autoClose?: boolean | number): void;Shows an info notification.
| Parameter | Type | Description |
|---|---|---|
message | string | Text of the notification. |
autoClose | boolean | number | Optional. As in showNotification(). Default: closes after 2 seconds. |
Returns: void · Availability: Client
setTitle()
Section titled “setTitle()”setTitle(title: string): void;Sets the title of the browser page, as shown in the browser tab. Same as assigning the title property.
| Parameter | Type | Description |
|---|---|---|
title | string | The new page title. |
Returns: void · Availability: Client
getTitle()
Section titled “getTitle()”getTitle(): string;Returns the current title of the browser page. Same as reading the title property.
Returns: string · Availability: Client
provideDownload()
Section titled “provideDownload()”provideDownload(content: any, fileName: string, mimeType?: string): void;Hands content to the browser as a file download, so the End user can save it.
| Parameter | Type | Description |
|---|---|---|
content | any | File content: a string, Blob, ArrayBuffer or typed array. Other values are converted to text. |
fileName | string | Name suggested to the End user for the downloaded file. |
mimeType | string | Optional. MIME type of the file, for example 'text/csv'. Default: none. |
Returns: void · Availability: Client
openDownloadInNewWindow()
Section titled “openDownloadInNewWindow()”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.
| Parameter | Type | Description |
|---|---|---|
content | any | File content: a string, Blob, ArrayBuffer or typed array. Other values are converted to text. |
fileName | string | Name of the file. |
mimeType | string | Optional. 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
Properties
Section titled “Properties”isSpinnerVisible
Section titled “isSpinnerVisible”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
spinnerText
Section titled “spinnerText”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