PackageManager

Summary

Package manager for coordinating the lifecycle of Mailspring packages.

An instance of this class is always available as the AppEnv.packages global.

Packages can be loaded, activated, and deactivated, and unloaded:

  • Loading a package reads and parses the package's metadata and resources such as keymaps, menus, stylesheets, etc.
  • Activating a package registers the loaded resources and calls activate() on the package's main module.
  • Deactivating a package unregisters the package's resources and calls deactivate() on the package's main module.
  • Unloading a package removes it completely from the package manager.

Packages can be enabled/disabled via the core.disabledPackages config settings and also by calling enablePackage()/disablePackage().

Instance Methods

onDidLoadInitialPackages(callback)

Invoke the given callback when all packages have been loaded.

Parameters

Argument Description
callback {Function}

Returns

Return Values
Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.

onDidActivateInitialPackages(callback)

Invoke the given callback when all packages have been activated.

Parameters
Argument Description
callback {Function}

Returns

Return Values
Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.

onDidActivatePackage(callback)

Invoke the given callback when a package is activated.

Parameters
Argument Description
callback A {Function} to be invoked when a package is activated.

Returns

Return Values
Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.

onDidDeactivatePackage(callback)

Invoke the given callback when a package is deactivated.

Parameters
Argument Description
callback A {Function} to be invoked when a package is deactivated.

Returns

Return Values
Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.

onDidLoadPackage(callback)

Invoke the given callback when a package is loaded.

Parameters
Argument Description
callback A {Function} to be invoked when a package is loaded.

Returns

Return Values
Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.

onDidUnloadPackage(callback)

Invoke the given callback when a package is unloaded.

Parameters
Argument Description
callback A {Function} to be invoked when a package is unloaded.

Returns

Return Values
Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.

getApmPath()

Get the path to the apm command. Return a {String} file path to apm.

getPackageDirPaths()

Get the paths being used to look for packages.

Returns
Return Values
Returns an {Array} of {String} directory paths.

resolvePackagePath(name)

Resolve the given package name to a path on disk. Return a {String} folder path or undefined if it could not be resolved.

Parameters
Argument Description
name The {String} package name.

isBundledPackage(name)

Is the package with the given name bundled with Nylas?

Parameters

Argument Description
name The {String} package name.

Returns

Return Values
Returns a {Boolean}.

enablePackage()

Enable the package with the given name.

Returns
Return Values
Returns the {Package} that was enabled or null if it isn't loaded.

disablePackage()

Disable the package with the given name.

Returns
Return Values
Returns the {Package} that was disabled or null if it isn't loaded.

isPackageDisabled(name)

Is the package with the given name disabled?

Parameters
Argument Description
name The {String} package name.

Returns

Return Values
Returns a {Boolean}.

getActivePackages()

Get an {Array} of all the active {Package}s.

getActivePackage(name)

Get the active {Package} with the given name.

Parameters
Argument Description
name The {String} package name.

Returns

Return Values
Returns a {Package} or .

isPackageActive(name)

Is the {Package} with the given name active?

Parameters
Argument Description
name The {String} package name.

Returns

Return Values
Returns a {Boolean}.

getLoadedPackages()

Get an {Array} of all the loaded {Package}s

getLoadedPackage(name)

Get the loaded {Package} with the given name.

Parameters
Argument Description
name The {String} package name.

Returns

Return Values
Returns a {Package} or .

getPluginIdsByPathBase()

Gets the root paths of all loaded packages. Useful when determining if an error originated from a package.

isPackageLoaded(name)

Is the package with the given name loaded?

Parameters
Argument Description
name The {String} package name.

Returns

Return Values
Returns a {Boolean}.

getAvailablePackagePaths()

Get an {Array} of {String}s of all the available package paths. If the optional windowType is passed, it will only load packages that declare that windowType in their package.json

getAvailablePackageNames()

Get an {Array} of {String}s of all the available package names.

getAvailablePackageMetadata()

Get an {Array} of {String}s of all the available package metadata.

results matching ""

    No results matching ""