Skip to content

Instantly share code, notes, and snippets.

@NickNaso
Last active May 25, 2018 18:02
Show Gist options
  • Select an option

  • Save NickNaso/42ce5f0bcca434f8bd95a428e2d454c0 to your computer and use it in GitHub Desktop.

Select an option

Save NickNaso/42ce5f0bcca434f8bd95a428e2d454c0 to your computer and use it in GitHub Desktop.
'use strict'
const EventEmitter = require('events').EventEmitter
const addon = require('bindings')('emit_from_cpp')
const emitter = new EventEmitter()
emitter.on('start', () => {
console.log('### START ...')
})
emitter.on('data', (evt) => {
console.log(evt);
})
emitter.on('end', () => {
console.log('### END ###')
})
addon.callEmit(emitter.emit.bind(emitter))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment