https://github.com/runnerty/module-core
Runnerty: Module Core
https://github.com/runnerty/module-core
Last synced: 4 months ago
JSON representation
Runnerty: Module Core
- Host: GitHub
- URL: https://github.com/runnerty/module-core
- Owner: runnerty
- License: mit
- Created: 2020-11-15T17:33:26.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-09-30T12:28:15.000Z (over 1 year ago)
- Last Synced: 2025-10-10T18:09:08.233Z (8 months ago)
- Language: JavaScript
- Size: 222 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Smart Processes Management
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url]
# Runnerty: Module Core
This module exposes the classes that Runnerty modules should extend from.
### Trigger example:
```javascript
const Trigger = require('@runnerty/module-core').Trigger;
class intervalTrigger extends Trigger {
constructor(chain, params) {
super(chain, params);
}
start() {
const checkCalendar = true;
const inputValues = [];
const customValues = {};
setTimeout(() => {
// Run Chain 🚀:
try {
this.startChain(checkCalendar, inputValues, customValues);
} catch (err) {
this.logger.error('startChain (intervalTrigger):', err);
}
}, this.params.interval);
}
}
module.exports = intervalTrigger;
```
### Executor example:
```javascript
const Executor = require('@runnerty/module-core').Executor;
class greetingExecutor extends Executor {
constructor(process) {
super(process);
this.options = {};
this.endOptions = { end: 'end' };
}
async exec(options) {
this.options = options;
try {
// Greeting 👋:
this.endOptions.messageLog = this.options.greeting;
this.end(this.endOptions);
} catch (err) {
this.endOptions.end = 'error';
this.endOptions.err_output = err.message;
this.end(this.endOptions);
}
}
}
module.exports = greetingExecutor;
```
### Notifier example:
```javascript
const Notifier = require('@runnerty/module-core').Notifier;
class consoleNotifier extends Notifier {
constructor(notification) {
super(notification);
}
// Notification sender 📤:
send(notification) {
notification.mode = notification.mode ? notification.mode.toString() : 'info';
notification.message = notification.message ? notification.message.toString() : '';
this.logger.log(notification.mode, notification.message);
this.end();
}
}
module.exports = consoleNotifier;
```
[runnerty]: http://www.runnerty.io
[downloads-image]: https://img.shields.io/npm/dm/@runnerty/module-core.svg
[npm-url]: https://www.npmjs.com/package/@runnerty/module-core
[npm-image]: https://img.shields.io/npm/v/@runnerty/module-core.svg
[david-badge]: https://david-dm.org/runnerty/module-core.svg
[david-badge-url]: https://david-dm.org/runnerty/module-core