Package Manager
The Package Manager in Inkdrop is responsible for the lifecycle management of packages. You can access a global instance of this class via inkdrop.packages
.
Package Lifecycle
Package lifecycle includes:
- Loading: Reads and parses the package's metadata and resources like keymaps, menus, stylesheets, etc.
- Activating: Registers the loaded resources and calls
activate()
on the package's main module. - Deactivating: Unregisters resources and calls
deactivate()
on the package's main module. - Unloading: Removes the package completely from the package manager.
You can enable or disable packages via the core.disabledPackages
config settings or by using enablePackage()
or disablePackage()
.
Package Load Completion Subscription
Invoke the callback when all packages have been loaded.
Parameters
- Name
callback()
- Type
- function
- Required
- Description
Function to be invoked upon package load completion.
Returns
Returns a Disposable for unsubscribing.
Initial Package Activation Subscription
Invoke the callback when all packages have been activated.
Parameters
- Name
callback()
- Type
- function
- Required
- Description
Function to be invoked upon the activation of all packages.
Returns
Returns a Disposable for unsubscribing.
Individual Package Activation Subscription
Invoke the callback when a specific package is activated.
Parameters
- Name
callback(package)
- Type
- function
- Required
- Description
Function to be invoked when a package is activated, where
package
is the Package that was activated.
Returns
Returns a Disposable for unsubscribing.
Package Deactivation Subscription
Invoke the callback when a package is deactivated.
Parameters
- Name
callback(package)
- Type
- function
- Required
- Description
Function to be invoked when a package is deactivated, where
package
is the Package that was deactivated.
Returns
Returns a Disposable for unsubscribing.
Package Load Subscription
Invoke the callback when a package is loaded.
Parameters
- Name
callback(package)
- Type
- function
- Required
- Description
Function to be invoked when a package is loaded, where
package
is the Package that was loaded.
Returns
Returns a Disposable for unsubscribing.
Package Unload Subscription
Invoke the callback when a package is unloaded.
Parameters
- Name
callback(package)
- Type
- function
- Required
- Description
Function to be invoked when a package is unloaded, where
package
is the Package that was unloaded.
Returns
Returns a Disposable for unsubscribing.
Get IPM Path
Get the path to the ipm
command.
Returns
Returns a String file path to ipm
.
Get Package Directory Paths
Get paths used for searching packages.
Returns
Returns an Array of String directory paths.
Resolve Package Path
Resolve a package name to a disk path.
Parameters
- Name
name
- Type
- string
- Required
- Description
The package name to be resolved.
Returns
Returns a String folder path or undefined if not resolvable.
Check if Package is Bundled
Determine if a package is bundled with Inkdrop.
Parameters
- Name
name
- Type
- string
- Required
- Description
Name of the package to check.
Returns
Returns a Boolean, true if bundled, otherwise false.
Enable Package
Enable the package with the specified name.
Parameters
- Name
name
- Type
- string
- Required
- Description
The name of the package to be enabled.
Returns
Returns the Package that was enabled, or null
if it isn't loaded.
Disable Package
Disable the package with the specified name.
Parameters
- Name
name
- Type
- string
- Required
- Description
The name of the package to be disabled.
Returns
Returns the Package that was disabled, or null
if it isn't loaded.
Check Package Disabled Status
Check if the package with the given name is disabled.
Parameters
- Name
name
- Type
- string
- Required
- Description
The name of the package to check.
Returns
Returns a Boolean: true
if disabled, false
if not.
Get Active Packages List
Retrieve an array of all the active packages.
Get Active Package
Get the active package with the specified name.
Parameters
- Name
name
- Type
- string
- Required
- Description
The name of the package to retrieve.
Returns
Returns the active Package or undefined
.
Check Package Active Status
Determine if the package with the specified name is active.
Parameters
- Name
name
- Type
- string
- Required
- Description
The name of the package to check.
Returns
Returns a Boolean indicating active status.
Get Loaded Packages List
Retrieve an array of all loaded packages.
Get Loaded Package
Get the loaded package with the specified name.
Parameters
- Name
name
- Type
- string
- Required
- Description
The name of the package to retrieve.
Returns
Returns the loaded Package or undefined
.
Check Package Loaded Status
Check if the package with the given name is loaded.
Parameters
- Name
name
- Type
- string
- Required
- Description
The name of the package to check.
Returns
Returns a Boolean indicating if the package is loaded.
Get Available Package Paths
Retrieve an array of paths for all available packages.
Returns
Returns an Array of Strings with all available package paths.
Get Available Package Names
Get a list of all available package names.
Returns
Returns an Array of Strings with all available package names.
Get Available Package Metadata
Obtain metadata for all available packages.
Returns
Returns an Array of Objects with metadata for all available packages.