Path: blob/trunk/third_party/closure/goog/net/xmlhttpfactory.js
4113 views
/**1* @license2* Copyright The Closure Library Authors.3* SPDX-License-Identifier: Apache-2.04*/56/**7* @fileoverview Interface for a factory for creating XMLHttpRequest objects8* and metadata about them.9*/1011goog.provide('goog.net.XmlHttpFactory');1213/** @suppress {extraRequire} Typedef. */14goog.require('goog.net.XhrLike');15161718/**19* Abstract base class for an XmlHttpRequest factory.20* @constructor21*/22goog.net.XmlHttpFactory = function() {};232425/**26* Cache of options - we only actually call internalGetOptions once.27* @type {?Object}28* @private29*/30goog.net.XmlHttpFactory.prototype.cachedOptions_ = null;313233/**34* @return {!goog.net.XhrLike.OrNative} A new XhrLike instance.35*/36goog.net.XmlHttpFactory.prototype.createInstance = goog.abstractMethod;373839/**40* @return {Object} Options describing how xhr objects obtained from this41* factory should be used.42*/43goog.net.XmlHttpFactory.prototype.getOptions = function() {44'use strict';45return this.cachedOptions_ ||46(this.cachedOptions_ = this.internalGetOptions());47};484950/**51* Override this method in subclasses to preserve the caching offered by52* getOptions().53* @return {Object} Options describing how xhr objects obtained from this54* factory should be used.55* @protected56*/57goog.net.XmlHttpFactory.prototype.internalGetOptions = goog.abstractMethod;585960