title: How can I write a generator in a JavaScript class?
body: <p>Usually, I write code like this:</p>
  
  <pre><code>//definition
  exports.getReply = function * (msg){
      //...
      return reply; 
  }
  //usage
  var msg = yield getReply ('hello');
  </code></pre>
  
  <p>but how can I write and use a generator in and out of an es6 class? I tried this:</p>
  
  <pre><code>class Reply{
      *getReply (msg){
          //...
          return reply; 
      }
       *otherFun(){
          this.getReply();  //`this` seem to have no access to `getReply`
      }
  }
  var Reply = new Reply();
  Reply.getReply();   //out of class,how can I get access to `getReply`?
  </code></pre>
  
  <p>I also tried:  </p>
  
  <pre><code> class Reply{
        getReply(){
           return function*(msg){
              //...
              return reply;
           }
        }
      }
  </code></pre>
  
  <p>All of these two methods seem to be wrong answers. So how can I write generator functions in a class correctly?</p>