PackageManager

Description

Package manager for coordinating the lifecycle of Atom packages.

An instance of this class is always available as the atom.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().

API documentation

Event Subscription

::onDidLoadInitialPackages(callback)

Invoke the given callback when all packages have been loaded.

Argument Description
callback

Function

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.

Argument Description
callback

Function

Return values
  • Returns a Disposable on which .dispose() can be called to unsubscribe.

::onDidActivatePackage(callback)

Invoke the given callback when a package is activated.

Argument Description
callback

A Function to be invoked when a package is activated.

package

The Package that was activated.

Return values
  • Returns a Disposable on which .dispose() can be called to unsubscribe.

::onDidDeactivatePackage(callback)

Invoke the given callback when a package is deactivated.

Argument Description
callback

A Function to be invoked when a package is deactivated.

package

The Package that was deactivated.

Return values
  • Returns a Disposable on which .dispose() can be called to unsubscribe.

::onDidLoadPackage(callback)

Invoke the given callback when a package is loaded.

Argument Description
callback

A Function to be invoked when a package is loaded.

package

The Package that was loaded.

Return values
  • Returns a Disposable on which .dispose() can be called to unsubscribe.

::onDidUnloadPackage(callback)

Invoke the given callback when a package is unloaded.

Argument Description
callback

A Function to be invoked when a package is unloaded.

package

The Package that was unloaded.

Return values
  • Returns a Disposable on which .dispose() can be called to unsubscribe.

Package system data

::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.

Return values

General package data

::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.

Argument Description
name

The String package name.

::isBundledPackage(name)

Is the package with the given name bundled with Atom?

Argument Description
name

The String package name.

Return values

Enabling and disabling packages

::enablePackage()

Enable the package with the given name.

Return values
  • Returns the Package that was enabled or null if it isn't loaded.

::disablePackage()

Disable the package with the given name.

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?

Argument Description
name

The String package name.

Return values

Accessing active packages

::getActivePackages()

Get an Array of all the active Packages.

::getActivePackage(name)

Get the active Package with the given name.

Argument Description
name

The String package name.

Return values

::isPackageActive(name)

Is the Package with the given name active?

Argument Description
name

The String package name.

Return values

Accessing loaded packages

::getLoadedPackages()

Get an Array of all the loaded Packages

::getLoadedPackage(name)

Get the loaded Package with the given name.

Argument Description
name

The String package name.

Return values

::isPackageLoaded(name)

Is the package with the given name loaded?

Argument Description
name

The String package name.

Return values

Accessing available packages

::getAvailablePackagePaths()

Get an Array of Strings of all the available package paths.

::getAvailablePackageNames()

Get an Array of Strings of all the available package names.

::getAvailablePackageMetadata()

Get an Array of Strings of all the available package metadata.