engine.io-client
Advanced tools
Comparing version 0.6.0 to 0.6.1
{ | ||
"name": "engine.io", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "component/emitter": "1.0.0", |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "0.0.6", | ||
"version": "1.0.0", | ||
"scripts": [ | ||
@@ -11,0 +11,0 @@ "index.js" |
@@ -10,3 +10,3 @@ | ||
* Initialize a new `Emitter`. | ||
* | ||
* | ||
* @api public | ||
@@ -84,4 +84,14 @@ */ | ||
Emitter.prototype.off = function(event, fn){ | ||
Emitter.prototype.off = | ||
Emitter.prototype.removeListener = | ||
Emitter.prototype.removeAllListeners = function(event, fn){ | ||
this._callbacks = this._callbacks || {}; | ||
// all | ||
if (0 == arguments.length) { | ||
this._callbacks = {}; | ||
return this; | ||
} | ||
// specific event | ||
var callbacks = this._callbacks[event]; | ||
@@ -107,3 +117,3 @@ if (!callbacks) return this; | ||
* @param {Mixed} ... | ||
* @return {Emitter} | ||
* @return {Emitter} | ||
*/ | ||
@@ -150,2 +160,1 @@ | ||
}; | ||
{ | ||
"name": "engine.io-parser", | ||
"version": "0.1.0", | ||
"version": "0.3.0", | ||
"dependencies": {}, | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -5,5 +5,10 @@ /** | ||
var keys = require('./keys') | ||
var keys = require('./keys'); | ||
/** | ||
* Current protocol version. | ||
*/ | ||
exports.protocol = 2; | ||
/** | ||
* Packet types. | ||
@@ -28,3 +33,3 @@ */ | ||
var err = { type: 'error', data: 'parser error' } | ||
var err = { type: 'error', data: 'parser error' }; | ||
@@ -46,3 +51,3 @@ /** | ||
exports.encodePacket = function (packet) { | ||
var encoded = packets[packet.type] | ||
var encoded = packets[packet.type]; | ||
@@ -80,3 +85,3 @@ // data fragment is optional | ||
* Encodes multiple messages (payload). | ||
* | ||
* | ||
* <length>:data | ||
@@ -97,4 +102,4 @@ * | ||
var encoded = '' | ||
, message | ||
var encoded = ''; | ||
var message; | ||
@@ -112,19 +117,18 @@ for (var i = 0, l = packets.length; i < l; i++) { | ||
* | ||
* @param {String} data | ||
* @return {Array} packets | ||
* @param {String} data, callback method | ||
* @api public | ||
*/ | ||
exports.decodePayload = function (data) { | ||
exports.decodePayload = function (data, callback) { | ||
var packet; | ||
if (data == '') { | ||
// parser error - ignoring payload | ||
return [err]; | ||
return callback(err, 0, 1); | ||
} | ||
var packets = [] | ||
, length = '' | ||
, n, msg, packet | ||
var length = '' | ||
, n, msg; | ||
for (var i = 0, l = data.length; i < l; i++) { | ||
var chr = data.charAt(i) | ||
var chr = data.charAt(i); | ||
@@ -136,3 +140,3 @@ if (':' != chr) { | ||
// parser error - ignoring payload | ||
return [err]; | ||
return callback(err, 0, 1); | ||
} | ||
@@ -144,3 +148,3 @@ | ||
// parser error - ignoring payload | ||
return [err]; | ||
return callback(err, 0, 1); | ||
} | ||
@@ -153,6 +157,7 @@ | ||
// parser error in individual packet - ignoring payload | ||
return [err]; | ||
return callback(err, 0, 1); | ||
} | ||
packets.push(packet); | ||
var ret = callback(packet, i + n, l); | ||
if (false === ret) return; | ||
} | ||
@@ -162,3 +167,3 @@ | ||
i += n; | ||
length = '' | ||
length = ''; | ||
} | ||
@@ -169,6 +174,5 @@ } | ||
// parser error - ignoring payload | ||
return [err]; | ||
return callback(err, 0, 1); | ||
} | ||
return packets; | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"description": "small debugging utility", | ||
"version": "0.7.0", | ||
"version": "0.7.2", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "debug", |
@@ -20,2 +20,4 @@ | ||
return function(fmt){ | ||
fmt = coerce(fmt); | ||
var curr = new Date; | ||
@@ -54,3 +56,5 @@ var ms = curr - (debug[name] || curr); | ||
debug.enable = function(name) { | ||
localStorage.debug = name; | ||
try { | ||
localStorage.debug = name; | ||
} catch(e){} | ||
@@ -122,4 +126,13 @@ var split = (name || '').split(/[\s,]+/) | ||
/** | ||
* Coerce `val`. | ||
*/ | ||
function coerce(val) { | ||
if (val instanceof Error) return val.stack || val.message; | ||
return val; | ||
} | ||
// persist | ||
if (window.localStorage) debug.enable(localStorage.debug); | ||
if (window.localStorage) debug.enable(localStorage.debug); |
@@ -213,3 +213,3 @@ ;(function(){ | ||
* Initialize a new `Emitter`. | ||
* | ||
* | ||
* @api public | ||
@@ -287,4 +287,14 @@ */ | ||
Emitter.prototype.off = function(event, fn){ | ||
Emitter.prototype.off = | ||
Emitter.prototype.removeListener = | ||
Emitter.prototype.removeAllListeners = function(event, fn){ | ||
this._callbacks = this._callbacks || {}; | ||
// all | ||
if (0 == arguments.length) { | ||
this._callbacks = {}; | ||
return this; | ||
} | ||
// specific event | ||
var callbacks = this._callbacks[event]; | ||
@@ -310,3 +320,3 @@ if (!callbacks) return this; | ||
* @param {Mixed} ... | ||
* @return {Emitter} | ||
* @return {Emitter} | ||
*/ | ||
@@ -354,3 +364,2 @@ | ||
}); | ||
@@ -374,5 +383,10 @@ require.register("component-indexof/index.js", function(exports, require, module){ | ||
var keys = require('./keys') | ||
var keys = require('./keys'); | ||
/** | ||
* Current protocol version. | ||
*/ | ||
exports.protocol = 2; | ||
/** | ||
* Packet types. | ||
@@ -397,3 +411,3 @@ */ | ||
var err = { type: 'error', data: 'parser error' } | ||
var err = { type: 'error', data: 'parser error' }; | ||
@@ -415,3 +429,3 @@ /** | ||
exports.encodePacket = function (packet) { | ||
var encoded = packets[packet.type] | ||
var encoded = packets[packet.type]; | ||
@@ -449,3 +463,3 @@ // data fragment is optional | ||
* Encodes multiple messages (payload). | ||
* | ||
* | ||
* <length>:data | ||
@@ -466,4 +480,4 @@ * | ||
var encoded = '' | ||
, message | ||
var encoded = ''; | ||
var message; | ||
@@ -481,19 +495,18 @@ for (var i = 0, l = packets.length; i < l; i++) { | ||
* | ||
* @param {String} data | ||
* @return {Array} packets | ||
* @param {String} data, callback method | ||
* @api public | ||
*/ | ||
exports.decodePayload = function (data) { | ||
exports.decodePayload = function (data, callback) { | ||
var packet; | ||
if (data == '') { | ||
// parser error - ignoring payload | ||
return [err]; | ||
return callback(err, 0, 1); | ||
} | ||
var packets = [] | ||
, length = '' | ||
, n, msg, packet | ||
var length = '' | ||
, n, msg; | ||
for (var i = 0, l = data.length; i < l; i++) { | ||
var chr = data.charAt(i) | ||
var chr = data.charAt(i); | ||
@@ -505,3 +518,3 @@ if (':' != chr) { | ||
// parser error - ignoring payload | ||
return [err]; | ||
return callback(err, 0, 1); | ||
} | ||
@@ -513,3 +526,3 @@ | ||
// parser error - ignoring payload | ||
return [err]; | ||
return callback(err, 0, 1); | ||
} | ||
@@ -522,6 +535,7 @@ | ||
// parser error in individual packet - ignoring payload | ||
return [err]; | ||
return callback(err, 0, 1); | ||
} | ||
packets.push(packet); | ||
var ret = callback(packet, i + n, l); | ||
if (false === ret) return; | ||
} | ||
@@ -531,3 +545,3 @@ | ||
i += n; | ||
length = '' | ||
length = ''; | ||
} | ||
@@ -538,6 +552,5 @@ } | ||
// parser error - ignoring payload | ||
return [err]; | ||
return callback(err, 0, 1); | ||
} | ||
return packets; | ||
}; | ||
@@ -596,2 +609,4 @@ | ||
return function(fmt){ | ||
fmt = coerce(fmt); | ||
var curr = new Date; | ||
@@ -630,3 +645,5 @@ var ms = curr - (debug[name] || curr); | ||
debug.enable = function(name) { | ||
localStorage.debug = name; | ||
try { | ||
localStorage.debug = name; | ||
} catch(e){} | ||
@@ -698,5 +715,15 @@ var split = (name || '').split(/[\s,]+/) | ||
/** | ||
* Coerce `val`. | ||
*/ | ||
function coerce(val) { | ||
if (val instanceof Error) return val.stack || val.message; | ||
return val; | ||
} | ||
// persist | ||
if (window.localStorage) debug.enable(localStorage.debug); | ||
}); | ||
@@ -703,0 +730,0 @@ require.register("engine.io/lib/index.js", function(exports, require, module){ |
0.6.1 / 2013-06-06 | ||
================== | ||
* engine.io: fixed build | ||
0.6.0 / 2013-05-31 | ||
@@ -3,0 +8,0 @@ ================== |
{ | ||
"name": "engine.io-client", | ||
"description": "Client for the realtime Engine", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"homepage": "https://github.com/LearnBoost/engine.io-client", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
395988
12827