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().


onDidLoadInitialPackages(callback)

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.


onDidActivateInitialPackages(callback)

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.


onDidActivatePackage(callback)

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.


onDidDeactivatePackage(callback)

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.


onDidLoadPackage(callback)

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.


onDidUnloadPackage(callback)

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.


getIpmPath()

Get IPM Path

Get the path to the ipm command.

Returns

Returns a String file path to ipm.


getPackageDirPaths()

Get Package Directory Paths

Get paths used for searching packages.

Returns

Returns an Array of String directory paths.


resolvePackagePath(name)

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.


isBundledPackage(name)

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.


enablePackage(name)

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.


disablePackage(name)

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.


isPackageDisabled(name)

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.


getActivePackages()

Get Active Packages List

Retrieve an array of all the active packages.

Returns

Returns an Array of active Packages.


getActivePackage(name)

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.


isPackageActive(name)

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.


getLoadedPackages()

Get Loaded Packages List

Retrieve an array of all loaded packages.

Returns

Returns an Array of loaded Packages.


getLoadedPackage(name)

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.


isPackageLoaded(name)

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.


getAvailablePackagePaths()

Get Available Package Paths

Retrieve an array of paths for all available packages.

Returns

Returns an Array of Strings with all available package paths.


getAvailablePackageNames()

Get Available Package Names

Get a list of all available package names.

Returns

Returns an Array of Strings with all available package names.


getAvailablePackageMetadata()

Get Available Package Metadata

Obtain metadata for all available packages.

Returns

Returns an Array of Objects with metadata for all available packages.

Can you help us improve the docs? 🙏

The source of these docs is here on GitHub. If you see a way these docs can be improved, please fork us!