code: function(state) {
      self.readyState = state;
      if (typeof self.onreadystatechange === "function") {
        self.onreadystatechange();
      }
  
      if ("readystatechange" in listeners) {
        var count = listeners["readystatechange"].length, i = 0;
        for(; i < count; i++) {
          listeners["readystatechange"][i].call(self);
        }
      }
    }
docs: Changes readyState and calls onreadystatechange.
  
  @param int state New state