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
|
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
|
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.
Uses the value of the core.apmPath config setting if it exists.
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
-
Returns a Boolean.
Enabling and disabling packages
::enablePackage(name)
Enable the package with the given name.
| Argument | Description |
|---|---|
name
|
The String package name. |
Return values
-
Returns the Package that was enabled or null if it isn't loaded.
::disablePackage(name)
Disable the package with the given name.
| Argument | Description |
|---|---|
name
|
The String package 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
-
Returns a Boolean.
Accessing active packages
::getActivePackages()
::getActivePackage(name)
Get the active Package with the given name.
| Argument | Description |
|---|---|
name
|
The String package name. |
Return values
-
Returns a Package or undefined.
::isPackageActive(name)
Is the Package with the given name active?
| Argument | Description |
|---|---|
name
|
The String package name. |
Return values
-
Returns a Boolean.
::hasActivatedInitialPackages()
Return values
-
Returns a Boolean indicating whether package activation has occurred.
Accessing loaded packages
::getLoadedPackages()
::getLoadedPackage(name)
Get the loaded Package with the given name.
| Argument | Description |
|---|---|
name
|
The String package name. |
Return values
-
Returns a Package or undefined.
::isPackageLoaded(name)
Is the package with the given name loaded?
| Argument | Description |
|---|---|
name
|
The String package name. |
Return values
-
Returns a Boolean.
::hasLoadedInitialPackages()
Return values
-
Returns a Boolean indicating whether package loading has occurred.