Home Reference Source
import Desktop from '@osjs/client/src/desktop.js'
public class | source

Desktop

Extends:

@osjs/event-emitter~EventEmitter → Desktop

Desktop Class

Constructor Summary

Public Constructor
public

constructor(core: Core, options: DesktopOptions)

Create Desktop

Member Summary

Public Members
public

$icons: Element[]

Icon DOM elements

public

$theme: Element[]

Theme DOM elements

public

Default context menu entries

public

Core instance reference

public

Icon View instance

public

keyboardContext: Element | null

Keyboard context dom element

public

Desktop Options

public

Search instance

public

Desktop subtraction rectangle TODO: typedef

Method Summary

Public Methods
public

Adds something to the default contextmenu entries

public

Adds or removes the icon view

public

Sets the current icon theme from settings

public

Applies settings and updates desktop

public

Sets the current style theme from settings

public

Create drop context menu entries

public

Destroy Desktop

public

Gets the rectangle of available space

public

init()

Initializes Desktop

public

Initializes base events

public

Initializes connection events

public

Initializes development tray icons

public

Initializes drag-and-drop events

public

Initializes global keyboard events

public

Initializes keyboard events

public

Initializes locales

public

Initializes mouse events

public

Initializes user interface events

public

onContextMenu(ev: Event)

When context menu is shown

public

onDeveloperMenu(ev: Event)

When developer menu is shown

public

onDropContextMenu(ev: Event, data: Object)

When drop menu is shown

public

setKeyboardContext(ctx: Element)

Sets the keyboard context.

public

start()

Starts desktop services

Private Methods
private

Apply settings by key

private

Apply theme wrapper

private

Removes current icon theme from DOM

private

Removes current style theme from DOM

private

Update CSS

Public Constructors

public constructor(core: Core, options: DesktopOptions) source

Create Desktop

Params:

NameTypeAttributeDescription
core Core

Core reference

options DesktopOptions
  • optional
  • default: {}

Options

Public Members

public $icons: Element[] source

Icon DOM elements

public $theme: Element[] source

Theme DOM elements

public contextmenuEntries: DesktopContextMenuEntry[] source

Default context menu entries

public core: Core source

Core instance reference

public iconview: DesktopIconView source

Icon View instance

public keyboardContext: Element | null source

Keyboard context dom element

public options: DeskopOptions source

Desktop Options

Search instance

public subtract: DesktopViewportRectangle source

Desktop subtraction rectangle TODO: typedef

Public Methods

public addContextMenu(entries: DesktopContextMenuEntry[]) source

Adds something to the default contextmenu entries

Params:

NameTypeAttributeDescription
entries DesktopContextMenuEntry[]

public applyIconView(settings: DesktopIconViewSettings) source

Adds or removes the icon view

Params:

NameTypeAttributeDescription
settings DesktopIconViewSettings

public applyIcons(name: string): Promise<undefined> source

Sets the current icon theme from settings

Params:

NameTypeAttributeDescription
name string

Icon theme name

Return:

Promise<undefined>

public applySettings(settings: DesktopSettings): DesktopSettings source

Applies settings and updates desktop

Params:

NameTypeAttributeDescription
settings DesktopSettings
  • optional

Use this set instead of loading from settings

Return:

DesktopSettings

New settings

public applyTheme(name: string): Promise<undefined> source

Sets the current style theme from settings

Params:

NameTypeAttributeDescription
name string

Theme name

Return:

Promise<undefined>

public createDropContextMenu(data: Object): Object[] source

Create drop context menu entries

Params:

NameTypeAttributeDescription
data Object

Drop data

Return:

Object[]

public destroy() source

Destroy Desktop

public getRect(): DesktopViewportRectangle source

Gets the rectangle of available space

This is based on any panels etc taking up space

public init() source

Initializes Desktop

public initBaseEvents() source

Initializes base events

public initConnectionEvents() source

Initializes connection events

public initDeveloperTray() source

Initializes development tray icons

public initDragEvents() source

Initializes drag-and-drop events

public initGlobalKeyboardEvents() source

Initializes global keyboard events

public initKeyboardEvents() source

Initializes keyboard events

public initLocales() source

Initializes locales

public initMouseEvents() source

Initializes mouse events

public initUIEvents() source

Initializes user interface events

public onContextMenu(ev: Event) source

When context menu is shown

Params:

NameTypeAttributeDescription
ev Event

public onDeveloperMenu(ev: Event) source

When developer menu is shown

Params:

NameTypeAttributeDescription
ev Event

public onDropContextMenu(ev: Event, data: Object) source

When drop menu is shown

Params:

NameTypeAttributeDescription
ev Event
data Object

public setKeyboardContext(ctx: Element) source

Sets the keyboard context.

Used for tabbing and other special events

Params:

NameTypeAttributeDescription
ctx Element
  • optional

public start() source

Starts desktop services

Private Methods

private _applySettingsByKey(k: string, v: *): Promise<boolean> source

Apply settings by key

Params:

NameTypeAttributeDescription
k string

Key

v *

Value

Return:

Promise<boolean>

private _applyTheme(name: string): Promise<undefined> source

Apply theme wrapper

Params:

NameTypeAttributeDescription
name string

Theme name

Return:

Promise<undefined>

private _removeIcons() source

Removes current icon theme from DOM

private _removeTheme() source

Removes current style theme from DOM

private _updateCSS() source

Update CSS