Skip to main content

Class: PluginManager

Defined in: components/App/pluginManager.ts:36

A wrapper class for initiating calls to Electron via desktopApi for managing plugins.

Constructors

Constructor

new PluginManager(): PluginManager;

Returns

PluginManager

Methods

cancel()

static cancel(identifier: string): Promise<void>;

Defined in: components/App/pluginManager.ts:146

Sends a request to cancel the operation (install, update, uninstall) for a plugin with the specified identifier.

Parameters

ParameterTypeDescription
identifierstringThe unique identifier for the plugin.

Returns

Promise<void>

Static

Async

Example

PluginManager.cancel('pluginID');

getStatus()

static getStatus(identifier: string): Promise<ProgressResp>;

Defined in: components/App/pluginManager.ts:202

Sends a request to get the status of a plugin with the specified identifier.

Parameters

ParameterTypeDescription
identifierstringThe unique identifier for the plugin.

Returns

Promise<ProgressResp>

  • A promise that resolves with the status of the plugin, or rejects with an error if the message limit or timeout is exceeded.

Static

Async

Example

try {
const status = await PluginManager.getStatus('pluginID');
console.log('Plugin status:', status);
} catch (error) {
console.error('Error:', error.message);
}

install()

static install(
identifier: string,
name: string,
URL: string): void;

Defined in: components/App/pluginManager.ts:85

Sends a request to install a plugin from the specified ArtifactHub URL.

Parameters

ParameterTypeDescription
identifierstringThe unique identifier for the plugin.
namestringThe name of the plugin to be installed.
URLstringThe URL from where the plugin will be installed.

Returns

void

Static

Example

PluginManager.install('pluginID', ' https://artifacthub.io/packages/headlamp/<repo_name>/<plugin_name>');

list()

static list(): Promise<Record<string, any> | undefined>;

Defined in: components/App/pluginManager.ts:171

Sends a request to list all installed plugins.

Returns

Promise<Record<string, any> | undefined>

  • A promise that resolves with a record of all installed plugins, or undefined if there was an error.

Throws

  • Throws an error if the response type is 'error'.

Static

Async

Example

try {
const plugins = await PluginManager.list();
console.log('Installed plugins:', plugins);
} catch (error) {
console.error('Error:', error.message);
}

uninstall()

static uninstall(identifier: string, name: string): void;

Defined in: components/App/pluginManager.ts:126

Sends a request to uninstall a plugin with the specified identifier and name.

Parameters

ParameterTypeDescription
identifierstringThe unique identifier for the plugin.
namestringThe name of the plugin to be uninstalled.

Returns

void

Static

Example

PluginManager.uninstall('pluginID', 'my-plugin');

update()

static update(identifier: string, name: string): void;

Defined in: components/App/pluginManager.ts:106

Sends a request to update a plugin with the specified identifier and name.

Parameters

ParameterTypeDescription
identifierstringThe unique identifier for the plugin.
namestringThe name of the plugin to be updated.

Returns

void

Static

Example

PluginManager.update('pluginID', 'my-plugin');