mbhall88 / masters_project

0 stars 0 forks source link

Add events to config file #14

Open mbhall88 opened 7 years ago

mbhall88 commented 7 years ago

Take all events and make a config file with them stored in an object rather than explicitly typing them as a string. This will prevent typos and also make debugging easier. E.g

module.exports = {
    events: {
        GREET: 'greet'
    }
};

// ....

var eventConfig  = require('./config');

emtr.on(eventConfig.GREET, function() {
    console.log("Somewhere, someone said hello");
});

emtr.emit(eventConfig.GREET);