veams-plugin-mixins

1.0.1 • Public • Published

VeamsMixins plugin

The VeamsMixins plugin is something where you can save global mixins. Mixins are object with functions in it which can be used to extend methods in other classes/modules.

import Veams from 'veams';
import VeamsMixins from 'veams/lib/plugins/mixins';

// Intialize core of Veams
Veams.initialize();

// Add plugins to the Veams system
Veams.use(VeamsMixins);

API:

When enabled the API provides a way to add a mixin to the container Veams.mixins.

Veams.addMixin('name', mixinFunction)
  • @param {String} name - Mixin name which will be used in the registration process.
  • @param {Function} mixinFunction - The mixin function should return an object with methods.

The method allows the registration of provided or custom mixins.

import Veams from 'veams';
import VeamsMixins from 'veams/lib/plugins/mixins';

import imageLoader from './utils/mixins/image-loader';

// Intialize core of Veams
Veams.initialize();

// Add plugins to the Veams system
Veams.use(VeamsMixins);
Veams.addMixin('imageLoader', imageLoader);

Later you can use this specific mixin in other modules:

myClass.mixin(Veams.mixins.imageLoader);

Here you see that you need to extend your custom class with the helper function mixin, which is available in Veams.helpers.

Readme

Keywords

Package Sidebar

Install

npm i veams-plugin-mixins

Homepage

veams.org/

Weekly Downloads

8

Version

1.0.1

License

MIT

Last publish

Collaborators

  • andy-gutsche
  • sebastian-fitzner