Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace GUI

This namespace is dedicated to all APIs related to AntOS UI system, these API are called AFX APIs which handle:

  • The mouse and keyboard interaction with the UI system
  • UI rendering
  • Custom tags definition
  • Load/unload system, applications and services UI
  • System dialogs definition

Index

Type aliases

TagEventCallback

TagEventCallback<T>: (e: TagEventType<T>) => void

Tag event callback type

Type parameters

  • T

Type declaration

Variables

dialog

dialog: BaseDialog

Reference to the current system dialog, only one dialog is allowed at a time. A dialog may have sub dialog

fullscreen

fullscreen: boolean = false

Indicate whether the system is in fullscreen mode

Const schemes

schemes: GenericObject<string>

HTML schemes used by the system:

  • The login screen scheme
  • The workspace including:
  • System panel
  • Virtual desktop
  • Context menu
  • System tooltip

workspace

workspace: string = "#desktop"

Element id of the virtual desktop, used by JQuery

zindex

zindex: number = 10

Top most element z index value, start by 10

Functions

appsByMime

  • Find a list of applications that support a specific mime type in the system packages meta-data

    export

    Parameters

    • mime: string

      the mime type

    Returns PackageMetaType[]

appsWithServices

  • Find all applications that have services attached to it. This function allows to collect all the services available on the system. These services may or may not be running.

    export

    Returns GenericObject<PackageMetaType>

    result in forme of: service_name:service-meta-data key-value pairs

attachservice

  • Attach a running service process to the system tray

    export

    Parameters

    • srv: BaseService

      reference to the running service process

    Returns void

bindKey

  • bindKey(k: string, f: (e: KeyDownEvent) => void, force?: boolean): void
  • Register a hot key and its handle in the system shortcut

    export

    Parameters

    • k: string

      the hotkey e.g. ALT-C

    • f: (e: KeyDownEvent) => void

      handle function

        • (e: KeyDownEvent): void
        • Parameters

          • e: KeyDownEvent

          Returns void

    • Default value force: boolean = true

      force to rebind the hotkey

    Returns void

clearTheme

  • clearTheme(): void

detachservice

  • Detach a running process from the system tray

    export

    Parameters

    • srv: BaseService

      reference to the running service process

    Returns void

dock

forceLaunch

  • Kil all processes related to an application, reload the application prototype definition and launch a new process of this application.

    This function is used only for debug purpose or used by AntOSDK during in-browser application development

    export

    Parameters

    • app: string

      the application class name

    • args: AppArgumentsType[]

      application arguments

    Returns void

htmlToScheme

  • htmlToScheme(html: string, app: BaseModel, parent: Element | string): void
  • Convert an application html scheme to UI elements, then insert this UI scheme to the DOM tree.

    This function renders the UI of the application before calling the application's main function

    export

    Parameters

    • html: string

      html scheme string

    • app: BaseModel

      reference to the target application

    • parent: Element | string

      The parent HTML element where the application is rendered. This is usually the reference to the virtual desktop element.

    Returns void

launch

loadScheme

  • Load an application scheme file then render it with htmlToScheme

    export

    Parameters

    • path: string

      VFS path to the scheme file

    • app: BaseModel

      the target application

    • parent: HTMLElement | string

      The parent HTML element where the application is rendered.

    Returns void

loadTheme

  • loadTheme(name: string, force: boolean): void
  • Load a theme based on its name, then refresh the system UI theme

    export

    Parameters

    • name: string

      name of the theme e.g. antos_dark

    • force: boolean

      force to clear the system theme before applying the new one

    Returns void

login

  • login(): void
  • Show the login screen and perform the login operation.

    Once login successfully, the startAntOS will be called

    export

    Returns void

openDialog

  • Open a system dialog.

    export

    Parameters

    Returns Promise<any>

    A promise on the callback data of the dialog, refer to each dialog definition for the format of the callback data

openWith

  • Find an launch an application using input application argument such as VFS file meta-data.

    Based on the input application argument, the function will try to find all applications that is compatible with that argument. Three cases possible:

    • There is no application that can handle the argument, a message will be notified to user.
    • There is one application that can handle the argument, the application will be launched with the argument
    • There are many applications that can handle the arguments, a selection dialog will be popped up and allows user to select an application to launch.
    export

    Parameters

    Returns void

pushService

  • Create a service process.

    Services are singleton processes, there is only one process of a service at a time

    export

    Parameters

    • ph: string

    Returns Promise<ProcessType>

pushServices

  • pushServices(srvs: string[]): Promise<void>
  • Synchronously start a list of services

    export

    Parameters

    • srvs: string[]

      list of service class names

    Returns Promise<void>

refreshDesktop

  • refreshDesktop(): void

startAntOS

  • startAntOS(conf: any): void
  • Start AntOS after a successful login.

    This function performs the following operations:

    • System cleanup
    • Apply system setting
    • Load desktop wallpaper and the current theme from the system setting
    • Load system package meta-data
    • Load and apply system locale and language
    export

    Parameters

    • conf: any

    Returns void

toggleFullscreen

  • toggleFullscreen(): void

undock

  • Remove an application process from the system application dock. This action will also exit the process

    export

    Parameters

    Returns void

unloadApp

  • unloadApp(app: string): void
  • Kill an running processes of an application, then unregister the application prototype definition from the application namespace.

    This process is similar to uninstall the application from the current system state

    export

    Parameters

    • app: string

    Returns void

wallpaper

  • Load and apply system wallpaper from the setting object

    export

    Parameters

    Returns void