1var event = require('events'); 2// console.log(event) 3 4var uartInstance = new event.EventEmitter(); 5 6uartInstance.on('data', function(arg, arg2) { 7 console.log('uart event: ', arg, arg2); 8}) 9 10setInterval(function() { 11 uartInstance.emit('data', 'this is uart data', 'data 2'); 12}, 1000);