1.0.5 • Published 8 years ago

remi-topmarks-results v1.0.5

Weekly downloads
6
License
Apache-2.0
Repository
github
Last release
8 years ago

Add Results Plugin

Build Status Code Climate Test Coverage Issue Count Dependency Status Inline docs npm version

A remi extension that adds the addResults method to the app so it can be used by plugins. Designed to specifically make it easier to make Topmarks plugins.

Installation

npm i remi-topmarks-results

Usage

Register the extension in the registration app.

import remi from 'remi';
import remiExpose from 'remi-topmarks-results';

const app = {};
const registrator = remi(app);
registrator.hook(addResults());

registrator.register({register: require('sample-plugin')});

Then plugins can use the addResults method:

let samplePlugin = (app, options next) => {
  // do some stuff and gather the results
  app.addResults('foo'); // There's an optional parameter for a timestamp, if none is specified it will default to now.
  next();
}

samplePlugin.attributes = {
  pkg: require('../package.json')
}

After the plugin has added results, they are accessible on as app.results. It is an array that will continue to push results when they are added.

When the plugin has url and/or pageId properties, they will be included in the results.

As sample result:

[ { plugin: 'plugin', timestamp: 1469770823748, report: 'foo' } ]
1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.0

8 years ago