Skip to content

Class AppsConfig

Source: appsConfig.ts

Extends

Constructors

Constructor

new AppsConfig(options?: Partial<AppsConfigOptions>): AppsConfig

Parameters

options?

Partial<AppsConfigOptions> = {}

Returns

AppsConfig

Overrides

EventEmitter<AppsConfigEvents>.constructor

Properties

apps

apps: App<WindowProps>[] = []


APPS_CHANGE_EVENT

readonly static APPS_CHANGE_EVENT: "appsChange" = "appsChange"


APP_ROLES

static APP_ROLES: { fileExplorer: string; terminal: string; textEditor: string; settings: string; mediaViewer: string; browser: string; }

fileExplorer

fileExplorer: string = "file-explorer"

terminal

terminal: string = "terminal"

textEditor

textEditor: string = "text-editor"

settings

settings: string = "settings"

mediaViewer

mediaViewer: string = "media-viewer"

browser

browser: string = "browser"

Methods

onAppsChange()

onAppsChange(listener: () => void): () => void

Parameters

listener

() => void

Returns

() => void


addApp()

addApp(app: App<WindowProps>): void

Parameters

app

App<WindowProps>

Returns

void


removeApp()

removeApp(id: string): boolean

Parameters

id

string

Returns

boolean


installApp()

installApp(target: string, options?: LoadAppOptions): Promise<App<WindowProps>>

Load an app from a URL or npm package and register it in the system. If an app with the same ID is already registered but uninstalled, it will be re-enabled instead of loaded again.

Parameters

target

string

The npm package name or URL to load the app from.

options?

LoadAppOptions

Returns

Promise<App<WindowProps>>

The loaded (or re-enabled) app.


uninstallApp()

uninstallApp(id: string): boolean

Parameters

id

string

Returns

boolean


getAppById()

getAppById(id: string, includeUninstalled?: boolean): App<WindowProps> | null

Parameters

id

string

The ID of the app.

includeUninstalled?

boolean = false

Include apps that are not currently installed.

Returns

App<WindowProps> | null


getAppByFileExtension()

getAppByFileExtension(fileExtension: string): App<WindowProps> | null

Get the app associated with a file extension.

Parameters

fileExtension

string

Returns

App<WindowProps> | null


getAppByRole()

getAppByRole(role: string): App<WindowProps> | null

Get the app with a specific role.

Parameters

role

string

Returns

App<WindowProps> | null


getAppsByCategory()

getAppsByCategory(category: "Business" | "Developer tools" | "Education" | "Entertainment" | "Food & dining" | "Health & fitness" | "Kids & family" | "Lifestyle" | "Media" | "Medical" | "Multimedia design" | "Music" | "Navigation & maps" | "News & weather" | "Personal finance" | "Personalization" | "Photo & video" | "Productivity" | "Security" | "Shopping" | "Social" | "Sports" | "Travel" | "Utilities & tools"): App<WindowProps>[]

Get all applications (including uninstalled apps) that belong to a category.

Parameters

category

"Business" | "Developer tools" | "Education" | "Entertainment" | "Food & dining" | "Health & fitness" | "Kids & family" | "Lifestyle" | "Media" | "Medical" | "Multimedia design" | "Music" | "Navigation & maps" | "News & weather" | "Personal finance" | "Personalization" | "Photo & video" | "Productivity" | "Security" | "Shopping" | "Social" | "Sports" | "Travel" | "Utilities & tools"

Returns

App<WindowProps>[]


on()

on<K>(event: K, listener: Listener<AppsConfigEvents, K>): Listener<AppsConfigEvents, K>

Starts listening to an event.

Type Parameters

K

K extends "appsChange"

Parameters

event

K

The event to listen to.

listener

Listener<AppsConfigEvents, K>

The function to call when the event is emitted.

Returns

Listener<AppsConfigEvents, K>

The listener.

Inherited from

EventEmitter.on


once()

once<K>(event: K, listener: Listener<AppsConfigEvents, K>): Listener<AppsConfigEvents, K>

Registers an event listener that is automatically removed when called.

Type Parameters

K

K extends "appsChange"

Parameters

event

K

The event to listen to.

listener

Listener<AppsConfigEvents, K>

The function to call once the event is emitted.

Returns

Listener<AppsConfigEvents, K>

The wrapped listener.

Inherited from

EventEmitter.once


off()

off<K>(event: K, listener: Listener<AppsConfigEvents, K>): void

Removes an event listener.

Type Parameters

K

K extends "appsChange"

Parameters

event

K

The event to remove the listener from.

listener

Listener<AppsConfigEvents, K>

The listener to remove.

Returns

void

Inherited from

EventEmitter.off


emit()

emit<K>(event: K, ...args: AppsConfigEvents[K]): void

Emits an event to all its listeners.

Type Parameters

K

K extends "appsChange"

Parameters

event

K

The event to emit.

args

...AppsConfigEvents[K]

The arguments to pass to the listeners.

Returns

void

Inherited from

EventEmitter.emit


emitAsync()

emitAsync<K>(event: K, ...args: AppsConfigEvents[K]): Promise<void>

Emits an event and waits for all listeners to resolve.

Type Parameters

K

K extends "appsChange"

Parameters

event

K

The event to emit.

args

...AppsConfigEvents[K]

The arguments to pass to the listeners.

Returns

Promise<void>

Inherited from

EventEmitter.emitAsync

Accessors

installedApps

Get Signature

get installedApps(): App<WindowProps>[]

Returns a list of all installed apps.

Returns

App<WindowProps>[]

Built by Prozilla