title: function to es6 class base style
body: <p>i'm newie in es6 and eventEmitter both. i've prepare a module in node event base style and now i'm trying to transform as es6 calass style. here it is</p>
  
  <p>// <strong>eventStyle.js</strong></p>
  
  <pre><code>const events = require('events');
  const util = require('util');
  
  var Customer = function() {
    // console.log(typeof this);
    events.EventEmitter.call(this);
    //    this is only public function
    this.register = function(email, password) {
    var newCustomer = {email:email, password:password}
    this.emit("newRegistation", newCustomer)
    }
  
    var _validate = function(customer) {
    if(customer.password=='password')
    this.emit("validated", customer)
    else
    this.emit("registationFailed", customer)
    }
  
    var _insert = function(customer) {
    this.emit("added", customer)
    }
  
    var _sendEmail = function(customer) {
    this.emit("emailSent", customer)
    }
  
    var _registationSuccessful = function(customer) {
    this.emit("registationSuccessful", customer)
    }
  
    this.on("newRegistation", _validate)
    this.on("validated", _insert)
    this.on("added", _sendEmail)
    this.on("emailSent", _registationSuccessful)
  }
  
  util.inherits(Customer, events.EventEmitter )
  </code></pre>
  
  <p>module.exports =  Customer</p>
  
  <p>//<strong>eventApp.js</strong></p>
  
  <pre><code>const Customer = require('./eventStyle');
  customer = new Customer();
  // console.log(customer);
  customer.on("registationSuccessful", ()=&gt;{
    console.log("well done");
  })
  
  customer.on("registationFailed", ()=&gt;{
    console.log("sorry error");
  })
  console.log(typeof customer.register);
  setTimeout(()=&gt;customer.register(), 1000);
  </code></pre>
  
  <p>//now my es6 based code (not working for me ) of <strong>eventStyle.js</strong></p>
  
  <pre><code>const events = require('events');
  const util = require('util');
  
  class Customer {
    constuctor(){
    console.log("cons",this);
    events.EventEmitter.call(this);
    this.on("newRegistation", _validate)
    this.on("validated", _insert)
    this.on("added", _sendEmail)
    this.on("emailSent", _registationSuccessful)
    }
  
    //    this is only public function
    register(email, password) {
    var newCustomer = {email:email, password:password}
    console.log(this);
    this.emit("newRegistation", newCustomer)
    }
  
    _validate(customer) {
    if(customer.password=='password')
    this.emit("validated", customer)
    else
    this.emit("registationFailed", customer)
    }
  
    _insert(customer) {
    this.emit("added", customer)
    }
  
    _sendEmail(customer) {
    this.emit("emailSent", customer)
    }
  
    _registationSuccessful(customer) {
    this.emit("registationSuccessful", customer)
    }
  }
  util.inherits(Customer, events.EventEmitter )
  
  module.exports =  Customer
  </code></pre>
  
  <p>somebody tell what i'm mistaking. thanks in advance</p>