1.0.0 • Published 7 years ago

ez-plugin v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

EzPlugin

A NodeJS module for easy simple plugin support.

Example

main.js

const EzPlugin = require('ez-plugin');

let ezPlugin = new EzPlugin();
ezPlugin.loadPlugins(__dirname+'/plugins');

let messageData = {msg: "Guten Tag!"};

ezPlugin.call('message', messageData);
console.log(messageData.msg);

plugins/message-changer.js

module.exports = {
  name: 'MessageChanger',
  version: '0.0.1',
  priority: 20,
  active: true,

  load: function() {
    console.log(`Plugin ${this.name} (${this.version}) loaded`);
  },
  unload: function() {
  },

  message: function(messageData) {
    messageData.msg += "(Changed)";
  }
};
1.0.0

7 years ago

0.1.0

8 years ago

0.0.1

8 years ago