Home

# Class goog.net.XhrManager

A manager of an XhrIoPool.

extends goog.events.EventTarget

Instance Method Summary
| `abort(string id, boolean= opt_force)` Aborts the request associated with id.
| `addXhrListener_(?goog.net.XhrIo xhrIo, ?Function func, (Array.<string>|null|string=) opt_types)` Adds a listener for XHR events on an XhrIo object.

`disposeInternal()`

Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:

    MyClass.prototype.disposeInternal = function() {
    MyClass.superClass_.disposeInternal.call(this);
    // Dispose logic for MyClass
    };

| `getOutstandingCount() ⇒ number` Returns the number of reuqests either in flight, or waiting to be sent.
| `handleAbort_(string id, ?goog.net.XhrIo xhrIo)` Handles the abort of an underlying XhrIo object.
| `handleAvailableXhr_(string id, ?goog.net.XhrIo xhrIo)` Handles when an XhrIo object becomes available. Sets up the events, fires the READY event, and starts the process to send the request.
| `handleComplete_(string id, ?goog.net.XhrIo xhrIo, ?goog.events.Event e) ⇒ ?Object` Handles the complete of a request. Dispatches the COMPLETE event and sets the the request as completed if the request has succeeded, or is done retrying.
| `handleError_(string id, ?goog.net.XhrIo xhrIo)` Handles the error of a request. If the request has not reach its maximum number of retries, then it lets the request retry naturally (will let the request hit the READY state). Else, it dispatches the ERROR event.
| `handleEvent_(string id, ?goog.events.Event e) ⇒ ?Object` Handles all events fired by the XhrIo object for a given request.
| `handleSuccess_(string id, ?goog.net.XhrIo xhrIo)` Handles the success of a request. Dispatches the SUCCESS event and sets the the request as completed.
| `removeXhrListener_(?goog.net.XhrIo xhrIo, ?Function func, (Array.<string>|null|string=) opt_types)` Remove listeners for XHR events on an XhrIo object.
| `retry_(string id, ?goog.net.XhrIo xhrIo)` Attempts to retry the given request. If the request has already attempted the maximum number of retries, then it removes the request and releases the XhrIo object back into the pool.

`send(string id, string url, string= opt_method, string= opt_content, (Object|goog.structs.Map|null=) opt_headers, <Any Type> opt_priority, ?Function= opt_callback, number= opt_maxRetries) ⇒ ?goog.net.XhrManager.Request`

Registers the given request to be sent. Throws an error if a request already exists with the given ID. NOTE: It is not sent immediately. It is queued and will be sent when an XhrIo object becomes available, taking into account the request's priority.

| `setTimeoutInterval(number ms)` Sets the number of milliseconds after which an incomplete request will be aborted. Zero means no timeout is set.