# veams-plugin-modules

> The VeamsModules plugin provides a whole system to initialize, render, save and destroy your modules.

Latest version **1.0.6** (published 2017-12-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install veams-plugin-modules
pnpm add veams-plugin-modules
yarn add veams-plugin-modules
bun add veams-plugin-modules
```

## 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.0.6 |
| Published | 2017-12-14 |
| First published | 2017-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Sebastian Fitzner |
| Maintainers | andy-gutsche, sebastian-fitzner |
| Keywords | veams, veams-plugin |

## Links

- npm: https://www.npmjs.com/package/veams-plugin-modules
- Repository: https://github.com/veams/veams-plugin-modules
- Homepage: http://veams.org/
- Issues: https://github.com/veams/veams-plugin-modules/issues
- npm.io page: https://npm.io/package/veams-plugin-modules

## Recent versions

- 1.0.6 (latest) — 2017-12-14
- 1.0.5 — 2017-12-14
- 1.0.4 — 2017-12-08
- 1.0.3 — 2017-12-06
- 1.0.2 — 2017-11-06
- 1.0.1 — 2017-09-07
- 1.0.0 — 2017-09-07

## README

# VeamsModules plugin

The VeamsModules plugin provides a whole system to initialize, render, save and destroy your modules.

It uses mutation observer to observe added and removed nodes and handles your components, as long as the component has the same API like [VeamsComponent](#veamscomponent).

__How to__

```js
import Veams from 'veams';
import VeamsModules from 'veams-plugin-modules';

// Intialize core of Veams
Veams.onInitialize(() => {
   	// Add plugins to the Veams system
	Veams.use(VeamsModules, {
	    useMutationObserver: true
	});
});
```

_API_

When enabled you can register a module like that:

```js
import CustomModule from './modules/custom';
import AnotherCustomModule from './modules/another-custom';
import ThirdCustomModule from './modules/third-custom';


// Register all at once
Veams.modules.register([
	{
        namespace: 'custom',
        module: CustomModule
    },
    {
        namespace: 'another-custom',
        module: AnotherCustomModule,
        conditions: () => {
            return Veams.detections.width < 768;
        },
        conditionsListenOn: [
            Veams.EVENTS.resize
        ]
    }
]);

// Or register single module 
Veams.modules.add({
	namespace: 'third-custom',
	module: ThirdCustomModule
})
```

_Options_

- _attrPrefix_ {`String`} [`'data-js'`] - You can override the javascript module indicator in your markup which will be searched in the context.
- _attrName_ {`String`} [`'module'`] - You can override the attribute name for module identification.
- _attrOptions_ {`String`} [`'options'`] - You can override the attribute name for options identification.
- _internalCacheOnly_ {`Boolean`} [`true`] - Hold internal cache in plugin and do not expose to the Veams object.
- _internalRegisterOnly_ {`Boolean`} [`false`] - Hold internal register in plugin and do not expose to the Veams object.
- _logs_ {`Boolean`} [`false`] - Hide or print the logs to the console.
- _useMutationObserver_ {`Boolean`} [`false`] - You can set this option to true to use mutation observer for ajax handling. You can also use `Veams.EVENTS.DOMchanged` as before.

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