mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
merged with master
This commit is contained in:
@@ -99,7 +99,7 @@ socket.on('open', function(){
|
||||
binary is encoded into base64 strings, and decoded when binary types are
|
||||
supported.
|
||||
- With browsers that don't support ArrayBuffer, an object { base64: true,
|
||||
data: dataAsBase64String } is emitted in onmessage
|
||||
data: dataAsBase64String } is emitted on the `message` event.
|
||||
|
||||
## API
|
||||
|
||||
@@ -111,12 +111,6 @@ Exposed as `eio` in the browser standalone build.
|
||||
#### Properties
|
||||
|
||||
- `protocol` _(Number)_: protocol revision number
|
||||
- `onopen` (_Function_)
|
||||
- `open` event handler
|
||||
- `onmessage` (_Function_)
|
||||
- `message` event handler
|
||||
- `onclose` (_Function_)
|
||||
- `message` event handler
|
||||
- `binaryType` _(String)_ : can be set to 'arraybuffer' or 'blob' in browsers,
|
||||
and `buffer` or `arraybuffer` in Node. Blob is only used in browser if it's
|
||||
supported.
|
||||
|
||||
@@ -68,6 +68,13 @@ function JSONPPolling (opts) {
|
||||
|
||||
// append to query string
|
||||
this.query.j = this.index;
|
||||
|
||||
// prevent spurious errors from being emitted when the window is unloaded
|
||||
if (global.document && global.addEventListener) {
|
||||
global.addEventListener('beforeunload', function () {
|
||||
if (self.script) self.script.onerror = empty;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +90,7 @@ inherit(JSONPPolling, Polling);
|
||||
JSONPPolling.prototype.supportsBinary = false;
|
||||
|
||||
/**
|
||||
* Closes the socket
|
||||
* Closes the socket.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
@@ -109,7 +116,7 @@ JSONPPolling.prototype.doClose = function () {
|
||||
*/
|
||||
|
||||
JSONPPolling.prototype.doPoll = function () {
|
||||
var self = this;
|
||||
var self = this;
|
||||
var script = document.createElement('script');
|
||||
|
||||
if (this.script) {
|
||||
|
||||
@@ -287,15 +287,15 @@ Request.prototype.abort = function(){
|
||||
};
|
||||
|
||||
/**
|
||||
* Cleanup is needed for IE that leaks memory unless we abort the request
|
||||
* before unload. It is also needed to prevent spurious errors from being
|
||||
* emimtted.
|
||||
* Aborts pending requests when unloading the window. This is needed to prevent
|
||||
* memory leaks (e.g. when using IE) and to ensure that no spurious error is
|
||||
* emitted.
|
||||
*/
|
||||
|
||||
if (global.document) {
|
||||
Request.requestsCount = 0;
|
||||
Request.requests = {};
|
||||
if (global.document.attachEvent) {
|
||||
if (global.attachEvent) {
|
||||
global.attachEvent('onunload', unloadHandler);
|
||||
} else if (global.addEventListener) {
|
||||
global.addEventListener('beforeunload', unloadHandler);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"xmlhttprequest": "https://github.com/LearnBoost/node-XMLHttpRequest/archive/0f36d0b5ebc03d85f860d42a64ae9791e1daa433.tar.gz",
|
||||
"emitter": "http://github.com/component/emitter/archive/1.0.1.tar.gz",
|
||||
"indexof": "0.0.1",
|
||||
"engine.io-parser": "1.0.3",
|
||||
"engine.io-parser": "1.0.4",
|
||||
"debug": "0.7.4",
|
||||
"parseuri": "0.0.2",
|
||||
"parsejson": "0.0.1",
|
||||
|
||||
Reference in New Issue
Block a user