Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BaseApplication

Abstract prototype of all AntOS applications. Any new application definition should extend this prototype

export
abstract

Hierarchy

Index

Constructors

constructor

Properties

Protected _api

_api: typeof API

Reference to the core API namespace

memberof

BaseModel

Protected _gui

_gui: typeof GUI

Reference to the core GUI namespace

memberof

BaseModel

Protected _observable

_observable: Announcer

Each model has its own local announcement system to handle all local events inside that model.

This observable object is propagate to all the UI elements (AFXTag) inside the model

memberof

BaseModel

appmenu

appmenu: MenuTag

Reference to the system application menu located on the system panel

memberof

BaseApplication

args

The argument of the model

memberof

BaseModel

birth

birth: number

Placeholder for the process creation timestamp

memberof

BaseModel

dialog

dialog: BaseDialog

Reference to the model's dialog

memberof

BaseModel

Protected host

host: string

The HTML element ID of the virtual desktop

memberof

BaseModel

Protected keycomb

keycomb: ShortcutType

Hotkeys (shortcuts) defined for this application

memberof

BaseApplication

name

name: string

The class name

memberof

BaseModel

pid

pid: number

The process number of the current model. For sub-window this number is the number of the parent window

memberof

BaseModel

scheme

scheme: HTMLElement

Reference the DOM element of the UI scheme belong to this model

memberof

BaseModel

setting

setting: GenericObject<any>

Placeholder of all settings specific to the application. The settings stored in this object will be saved to system setting when logout and can be reused in the next login session

memberof

BaseApplication

sysdock

sysdock: AppDockTag

Reference to the system dock

memberof

BaseApplication

Protected systemsetting

systemsetting: typeof setting

Reference to the system setting

memberof

BaseModel

Static dependencies

dependencies: string[]

The javascript or css files that the model depends on. All dependencies will be loaded before the model is rendered

static
memberof

BaseModel

Static meta

Place holder for model meta-data

static
memberof

BaseModel

Static singleton

singleton: boolean

Allow singleton on this model

static
memberof

BaseModel

Static style

style: HTMLElement | string

Reference to the CSS Element of the model

static
memberof

BaseModel

Static type

type: ModelType

Different model type

static
memberof

BaseModel

Accessors

observable

Methods

Protected applyAllSetting

  • applyAllSetting(): void

Protected applySetting

  • applySetting(k: string): void
  • Apply a setting to the application

    memberof

    BaseApplication

    Parameters

    • k: string

      the setting name

    Returns void

Protected ask

Protected baseMenu

  • Base menu definition. This function returns the based menu definition of all applications. Other application specific menu entries should be defined in menu function

    memberof

    BaseApplication

    Returns BasicItemType[]

Protected bindKey

  • bindKey(k: string, f: (e: KeyboardEventBase) => void): void
  • Bind a hotkey to the application, this function is used to define application keyboard shortcut

    memberof

    BaseApplication

    Parameters

    • k: string

      the hotkey to bind, should be in the following format: [ALT|SHIFT|CTRL|META]-KEY, e.g. CTRL-S

    • f: (e: KeyboardEventBase) => void

      the callback function

        • (e: KeyboardEventBase): void
        • Parameters

          • e: KeyboardEventBase

          Returns void

    Returns void

blur

  • blur(): void

Protected call

  • Execute a server side script and get back the result

    memberof

    BaseModel

    Parameters

    • cmd: GenericObject<any>

      execution indication, should be:

      {
           path?: string, // VFS path to the server side script
           code: string, // or server side code to be executed
           parameters: any // the parameters of the server side execution
      }
      

    Returns Promise<any>

Protected cleanup

  • The cleanup function that is called by onexit function. Application need to override this function to perform some specific task before exiting or to prevent the application to be exited

    memberof

    BaseApplication

    Parameters

    Returns void

error

fail

  • fail(m: string, e?: Error): void

Protected find

hide

  • hide(): void

init

  • init(): void
  • Init the application, this function is called when the application process is created and docked in the application dock.

    The application UI will be rendered after the execution of this function.

    memberof

    BaseApplication

    Returns void

Protected load

  • load(promise: Promise<any>): Promise<void>
  • API function to perform an heavy task. This function will trigger the global loading event at the beginning of the task, and the loaded event after finishing the task

    memberof

    BaseApplication

    Parameters

    • promise: Promise<any>

      the promise on a task to be performed

    Returns Promise<void>

Protected loadScheme

  • loadScheme(): void
  • Render the application UI by first loading its scheme and then mount this scheme to the DOM tree

    memberof

    BaseApplication

    Returns void

Abstract main

  • main(): void
  • The main application entry that is called after the application UI is rendered. This application must be implemented by all subclasses

    abstract
    memberof

    BaseApplication

    Returns void

Protected menu

meta

notify

Protected off

  • off(e: string, f?: (d: any) => void): void
  • Unsubscribe an event

    memberof

    BaseModel

    Parameters

    • e: string

      event name or * (all events)

    • Optional f: (d: any) => void
        • (d: any): void
        • Parameters

          • d: any

          Returns void

    Returns void

Protected on

  • on(e: string, f: (d: any) => void): void
  • Subscribe to a local event

    memberof

    BaseModel

    Parameters

    • e: string

      event name

    • f: (d: any) => void

      event callback

        • (d: any): void
        • Parameters

          • d: any

          Returns void

    Returns void

Protected one

  • one(e: string, f: (d: any) => void): void
  • subscribe once to a local event

    memberof

    BaseModel

    Parameters

    • e: string

      name of the event

    • f: (d: any) => void

      event callback

        • (d: any): void
        • Parameters

          • d: any

          Returns void

    Returns void

Protected onexit

openDialog

path

  • path(): string

Protected publish

quit

  • quit(force: boolean): void

Protected registry

  • registry(k: string, v: any): void
  • Set a setting value to the application setting registry

    memberof

    BaseApplication

    Parameters

    • k: string

      setting name

    • v: any

      setting value

    Returns void

Protected render

  • render(p: string): void

Protected select

shortcut

  • shortcut(fnk: string, c: string, e: KeyDownEvent): boolean
  • Execute the callback subscribed to a keyboard shortcut

    memberof

    BaseApplication

    Parameters

    • fnk: string

      meta or modifier key e.g. CTRL, ALT, SHIFT or META

    • c: string

      a regular key

    • e: KeyDownEvent

      JQuery keyboard event

    Returns boolean

    return whether the shortcut is executed

show

  • show(): void

Protected stream

  • stream(): Promise<WebSocket>
  • Connect to the server side api using a websocket connection

    Server side script can be execute inside the stream by writing data in JSON format with the following interface

    {
         path?: string, // VFS path to the server side script
         code: string, // or server side code to be executed
         parameters: any // the parameters of the server side execution
    }
    
    memberof

    BaseModel

    Returns Promise<WebSocket>

Protected subscribe

  • subscribe(e: string, f: (d: any) => void): void
  • subscribe to an event on the global announcement system

    memberof

    BaseModel

    Parameters

    • e: string

      event name

    • f: (d: any) => void

      event callback

        • (d: any): void
        • Parameters

          • d: any

          Returns void

    Returns void

throwe

  • throwe(): Error

title

toggle

  • toggle(): void

Protected trigger

  • trigger(e: string, d?: any): void

update

  • update(): void

Private updateLocale

  • updateLocale(name: string): void

warn