const EventEmiter = require('events').EventEmitter;
const Course = function () {};
Course.prototype.__proto__ = EventEmiter.prototype;
let a = new Course();
a.on('classon', function () {
console.log('上课了');
});
setTimeout(function () {
a.emit('classon');
}, 2000);
网友评论