Skip to content

Instantly share code, notes, and snippets.

@NickNaso
Created January 3, 2018 21:42
Show Gist options
  • Save NickNaso/7c9257e9e13d4e96ed53ea6f42145a51 to your computer and use it in GitHub Desktop.
Save NickNaso/7c9257e9e13d4e96ed53ea6f42145a51 to your computer and use it in GitHub Desktop.
Hertzy example
'use strict'
const const Hertzy = require('hertzy')
// Obtain or create new frequency, a channel where you can emit or listen for an
// event issued by other modules
const usr = Hertzy.tune('user')
// Listen for event 'user:add'
usr.on('user:add', function (data) {
console.log('NEW USER ADDED WITH FOLLOWING DATA:')
console.log(data)
})
// Emit event 'user:add'
usr.emit('user:add', {
username: 'NickNaso',
password: '********',
email: 'nicoladelgobbo@gmail.com'
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment