Created
January 3, 2018 21:42
-
-
Save NickNaso/7c9257e9e13d4e96ed53ea6f42145a51 to your computer and use it in GitHub Desktop.
Hertzy example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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