5.0.4 • Published 4 years ago

esun-plugins v5.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Install

npm install --save esun-plugins

Or if you prefer yarn:

yarn add esun-plugins

Usage

Adding a plugin

import { registerPlugins } from "esun-plugins";

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

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

Getting a single plugin by name

// anywhere in your app
import { getPlugin } from "esun-plugins";

const plugin = getPlugin("my-plugin");
plugin.render();

Getting plugins by type

// anywhere in your app
import { getPlugins } from "esun-plugins";

const plugins = getPlugins("say-hi");
plugins.forEach(plugin => {
    plugin.render();
});

Removing a plugin

// anywhere in your app
import { unregisterPlugin } from "esun-plugins";

unregisterPlugin("my-plugin");

renderPlugin

// anywhere in your app
import { renderPlugin } from "esun-plugins";

<div>
  {renderPlugin('my-plugin', {})}
</div>

renderPlugins

// anywhere in your app
import { renderPlugins } from "esun-plugins";

<div>
  {renderPlugins('say-hi', {})}
</div>
5.0.4

4 years ago

5.0.3

4 years ago

5.0.2

4 years ago

5.0.1

4 years ago

4.0.5

4 years ago

4.0.4

4 years ago

4.0.3

4 years ago

1.1.0

4 years ago

4.0.0

4 years ago

4.0.2

4 years ago

3.0.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago