Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webiny/plugins

Package Overview
Dependencies
Maintainers
1
Versions
529
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webiny/plugins

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

  • 5.38.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@webiny/plugins

code style: prettier PRs Welcome

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.

Install

npm install --save @webiny/plugins

Or if you prefer yarn:

yarn add @webiny/plugins

Usage

Adding a plugin

import { plugins } from "@webiny/plugins";

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

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

Getting plugins by type

// anywhere in your app
import { plugins } from "@webiny/plugins";

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

Getting a single plugin by name

// anywhere in your app
import { plugins } from "@webiny/plugins";

const plugin = plugins.byName("my-plugin");
// Call "salute" function
plugin.salute();

Removing a plugin

// anywhere in your app
import { plugins } from "@webiny/plugins";

plugins.unregister("my-plugin");

FAQs

Package last updated on 16 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc