Package Exports
- minibase-create-plugin
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (minibase-create-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
minibase-create-plugin

Install
Install with npm
$ npm i minibase-create-plugin --save
Usage
For more use-cases see the tests
const minibaseCreatePlugin = require('minibase-create-plugin')
API
minibaseCreatePlugin
Creates a plugin for Base and MiniBase, that uses the minibase-is-registered under the hood to provide more stable and friendly API for plugins.
Params
name
{String}: name of the plugin, passed to.isRegistered
fn
{Function}: plugin function, passed to.use
method, so called immediatelyreturns
{Function}: plugin function that should be passed to.use
method
Example
var minibase = require('minibase')
var createPlugin = require('minibase-create-plugin')
var called = 0
var plugin = createPlugin('foo-bar', function (self) {
called++
self.foo = 'bar'
self.define('qux', function quxMethod () {})
self.define('abc', function abc () {})
})
minibase.use(plugin)
minibase.use(plugin)
console.log(minibase.foo) // => 'bar'
console.log(minibase.qux) // => Function: qux
console.log(minibase.abc) // => Function: abc
console.log(minibase.registered) // => { 'foo-bar': ['qux', 'abc'] }
// called only once
console.log(called) // => 1
Related
- minibase-assert: Plugin for minibase and base, that adds assertion methods - most of assert-kindof methods and built-ins assert module. | homepage
- minibase-better-define: Plugin for base and minibase that overrides the core
.define
method to be more better. | homepage - minibase-is-registered: Plugin for minibase and base, that adds
isRegistered
method to your application to detect if plugin is already registered and returns true or false if… more | homepage - minibase-visit: Plugin for minibase and base, that adds
.visit
method to your application to visit a method over the items in an object, or map visit… more | homepage - minibase: MiniBase is minimalist approach to Base - @node-base, the awesome framework. Foundation for building complex APIs with small units called plugins. Works well with most… more | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.