Skip to content

Instantly share code, notes, and snippets.

@pjchender
Last active May 22, 2017 14:12
Show Gist options
  • Save pjchender/e44b45d12d6ab1c52bc141ca1c3c1580 to your computer and use it in GitHub Desktop.
Save pjchender/e44b45d12d6ab1c52bc141ca1c3c1580 to your computer and use it in GitHub Desktop.
[Node][Unit34] Putting string variable in configuration.js
const Emitter = require('events')
const eventsConfig = require('./config').events
let emtr = new Emitter()
emtr.on(eventsConfig.GREET, function () {
console.log('Somewhere, someone said hello')
})
emtr.on(eventsConfig.GREET, function () {
console.log('A greeting occurred')
})
console.log('Hello')
emtr.emit(eventsConfig.GREET)
module.exports = {
events: {
GREET: 'greet',
SAVE_FILE: 'saveFile'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment