Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Stomple.debug bugfix

  • Loading branch information...
commit 5eb14bfa5555dcc5c3ef6f2b9e5719e592aef87a 1 parent 35df585
@krukow authored
Showing with 12 additions and 11 deletions.
  1. +12 −11 src/stomple.js
View
23 src/stomple.js
@@ -39,7 +39,7 @@
infoAvailable = globalObject.console && typeof globalObject.console.info === 'function',
trim;
if (typeof WebSocket === 'undefined' || !WebSocket || globalObject.Stomple) {
- if (warnAvailable && Stomple.debug) {
+ if (warnAvailable) {
globalObject.console.warn(globalObject.Stomple?"Stomple already defined.":"Stomple: WebSockets not available");
}
globalObject.Stomple = globalObject.Stomple || false;
@@ -183,26 +183,27 @@
command: null,
headers: null,
body: null,
- toString: function() {
- var res = [this.command, '\n'],
+ toString: function() {//http://www.sitepen.com/blog/2008/05/09/string-performance-an-analysis/
+ var res = this.command,
h,
hds = this.headers;
+ res += '\n';
if (hds) {
for (h in hds) {
if(hds.hasOwnProperty(h)) {
- res.push(h);
- res.push(':');
- res.push(hds[h]);
- res.push('\n');
+ res += h;
+ res += ':';
+ res += hds[h];
+ res += '\n';
}
}
}
- res.push('\n');
+ res += '\n';
if (this.body) {
- res.push(this.body);
+ res += this.body;
}
- res.push(NULL);
- return res.join('');
+ res += NULL;
+ return res;
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.