UNPKG

class-o-mat

Version:

ALPHA VERSION ONLY: class-o-mats will help to create getter-setter functionality with validations that can be attached to a container class for easier coding. Some basic validations are included. class-o-mats also has the ability to store params as bloc

41 lines (29 loc) 894 B
import Bunyan from 'bunyan'; const log = Bunyan.createLogger({name: "TestPlugin"}); import Plugin from '../lib/plugins/plugin'; const constructorAddOn =({classOMat, mixins, defaults, params})=>{ return function(...p) { this.I_AM_PLUGGED_IN = 'PLUGGEDIN!'; } } const newMixins = { getX: function() { return 20; }, getTYPE: function() { return this.TYPE; } } const onSetCallback =(classOMat, key, value)=>{ console.log('I have set something! '); } const onGetCallback =(classOMat, key, value)=>{ console.log('I have gotten something'); } const testPlugin = new Plugin().init('testPlugin'); // testPlugin.appendToConstructor(constructorAddOn); // testPlugin.addMixins(newMixins); // testPlugin.onSet(onSetCallback); // testPlugin.onGet(onGetCallback); // testPlugin.field('molly').default('wanna').validate().string().$(); export default testPlugin;