# webiny-plugins

> A simple registry that stores all plugins in a shared object.

Latest version **1.15.1** (published 2019-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install webiny-plugins
pnpm add webiny-plugins
yarn add webiny-plugins
bun add webiny-plugins
```

## 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.15.1 |
| Published | 2019-05-27 |
| First published | 2018-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 20.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | webiny |

## Links

- npm: https://www.npmjs.com/package/webiny-plugins
- Repository: https://github.com/webiny/webiny-js
- Homepage: https://github.com/webiny/webiny-js#readme
- Issues: https://github.com/webiny/webiny-js/issues
- npm.io page: https://npm.io/package/webiny-plugins

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.0.0

## Recent versions

- 1.15.1 (latest) — 2019-05-27
- 1.15.0 — 2019-05-25
- 1.14.2 — 2019-05-17
- 1.14.1 — 2019-05-07
- 1.14.0 — 2019-05-07
- 1.13.1 — 2019-04-14
- 1.13.0 — 2019-03-27
- 1.12.7 — 2019-03-18
- 1.12.6 — 2019-03-17
- 1.12.5 — 2019-03-17
- 1.12.4 — 2019-03-16
- 1.12.3 — 2019-03-14
- 1.12.2 — 2019-03-05
- 1.12.1 — 2019-03-04
- 1.12.0 — 2019-02-14
- … 14 more at https://npm.io/package/webiny-plugins/versions

## README

# webiny-plugins
[![](https://img.shields.io/npm/dw/webiny-plugins.svg)](https://www.npmjs.com/package/webiny-plugins) 
[![](https://img.shields.io/npm/v/webiny-plugins.svg)](https://www.npmjs.com/package/webiny-plugins)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

A simple registry that stores all plugins in a shared object.
The only requirement for a plugin is to have a `name` and a `type` properties. 
The rest is entirely up to you.

There is nothing spectacular going on under the hood, just a simple 
object for storing references and a few utility functions.

For more information, please visit [the official docs](https://docs.webiny.com/docs/developer-tutorials/plugins-crash-course).
  
## Install
```
npm install --save webiny-plugins
```

Or if you prefer yarn: 
```
yarn add webiny-plugins
```

## Usage

### Adding a plugin
```
import { registerPlugins } from "webiny-plugins";

// Add a plugin
registerPlugins({
    name: "my-plugin",
    type: "say-hi",
    salute: () => "Hi!"
});

registerPlugins({
    name: "my-second-plugin",
    type: "say-hi",
    salute: () => "Yo!"
});
```

### Getting plugins by type
```
// anywhere in your app
import { getPlugins } from "webiny-plugins";

const plugins = getPlugins("say-hi");
plugins.forEach(plugin => {
    // Call "salute" function
    plugin.salute();
});
```

### Getting a single plugin by name
```
// anywhere in your app
import { getPlugin } from "webiny-plugins";

const plugin = getPlugin("my-plugin");
// Call "salute" function
plugin.salute();
```

### Removing a plugin
```
// anywhere in your app
import { unregisterPlugin } from "webiny-plugins";

unregisterPlugin("my-plugin");
```

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