# minsky-plugin-manager

> A manager that can be added to classes internally in order to have a plugin structure.

Latest version **1.0.0** (published 2020-09-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install minsky-plugin-manager
pnpm add minsky-plugin-manager
yarn add minsky-plugin-manager
bun add minsky-plugin-manager
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-09-28 |
| First published | 2020-09-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Minsky |
| Maintainers | minsky |

## Links

- npm: https://www.npmjs.com/package/minsky-plugin-manager
- Repository: https://bitbucket.org/Minsky_WebAgency/pluginmanager
- Homepage: https://bitbucket.org/Minsky_WebAgency/pluginmanager#readme
- npm.io page: https://npm.io/package/minsky-plugin-manager

## Dependencies (1)

- [minsky-core](https://npm.io/package/minsky-core.md) ^1.0.2

## Recent versions

- 1.0.0 (latest) — 2020-09-28

## README

# Plugin Manager

**A manager that can be added to classes internally in order to have a plugin structure.**

This manager should run inside a class providing a way to support a plugin-like structure.
Even though it is still unfinished, it is already somewhat incorporated inside some classes.

Class type: `Manager`

## Dependencies

* Core 1.0.0

---

## Getting started

Inits in a static way. Provided class definition gets the right injections every time it is constructed.

```
// Add to the bottom of the class
let plugins = new PluginManager({
    Target: [Class],
});
```

### Constructor Parameters

#### Target

Type: `Class`
Default: `none`

The target class definition it will manage.

#### plugins

Type: `Array`
Default: `[]`

Array of plugins it will automatically define when it is constructed.

---

## Interface

### Options

#### Target

Type: `Class`
Default: `none`

The target class definition it will manage.

#### plugins

Type: `Array`
Default: `[]`

Array of plugins it will automatically define when it is constructed.

### Properties

#### Target

Type: `Class`
Default: `none`

The target class definition it will manage.

#### plugins

Type: `Array`
Default: `[]`

Array of plugins it will automatically define when it is constructed.

### Methods

#### define

Parameters: `plugins:Array`
Return: `undefined`

Registers a plugin so it can be added to every instance that is managed by the manager.

#### get

Parameters: `pluginsId:Number`
Return: `Plugin Object`

Returns the requested plugin if found.

#### setOption

Parameters: `pluginsId:Number, options:Object`
Return: `Plugin Object`

Sets the given options by merging the given options object with the one of the given plugin.

#### run

Parameters: `method:String, args:Object, scope:Function/Object`
Return: `Undefined`

Runs a specific method of the class it manages with given args. Scope can be altered with the third parameter.

#### logPlugins

Parameters: `none`
Return: `undefined`

Logs a list of registered plugins => usefull for development

#### destroy

Parameters: `none`
Return: `undefined`

Destroys the plugin manager.

---

## To Do

* Finish the class
* Fix scope inconsistencies.
* Provide plugin base class instead of using object literal as plugin definition.
	* Provide plugin with setOption method for quickly deep mergin of object settings

---
_Source: https://npm.io/package/minsky-plugin-manager · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
