code: function generate(state) {
    return function proxy(fn, context) {
      var rs = this;
  
      if (rs.is(state)) {
        setTimeout(function () {
          fn.call(context, rs.readyState);
        }, 0);
      } else {
        if (!rs._events[state]) rs._events[state] = [];
        rs._events[state].push({ fn: fn, context: context });
      }
  
      return rs;
    };
  }
docs: Generate a new prototype method which will the given function once the
  desired state has been reached. The returned function accepts 2 arguments:
  
  - fn: The assigned function which needs to be called.
  - context: Context/this value of the function we need to execute.
  
  @param {String} state The state we need to operate upon.
  @returns {Function}
  @api private