Path: blob/trunk/third_party/closure/goog/net/wrapperxmlhttpfactory.js
4020 views
/**1* @license2* Copyright The Closure Library Authors.3* SPDX-License-Identifier: Apache-2.04*/56/**7* @fileoverview Implementation of XmlHttpFactory which allows construction from8* simple factory methods.9*/1011goog.provide('goog.net.WrapperXmlHttpFactory');1213/** @suppress {extraRequire} Typedef. */14goog.require('goog.net.XhrLike');15goog.require('goog.net.XmlHttpFactory');16171819/**20* An xhr factory subclass which can be constructed using two factory methods.21* This exists partly to allow the preservation of goog.net.XmlHttp.setFactory()22* with an unchanged signature.23* @param {function():!goog.net.XhrLike.OrNative} xhrFactory24* A function which returns a new XHR object.25* @param {function():!Object} optionsFactory A function which returns the26* options associated with xhr objects from this factory.27* @extends {goog.net.XmlHttpFactory}28* @constructor29* @final30*/31goog.net.WrapperXmlHttpFactory = function(xhrFactory, optionsFactory) {32'use strict';33goog.net.XmlHttpFactory.call(this);3435/**36* XHR factory method.37* @type {function() : !goog.net.XhrLike.OrNative}38* @private39*/40this.xhrFactory_ = xhrFactory;4142/**43* Options factory method.44* @type {function() : !Object}45* @private46*/47this.optionsFactory_ = optionsFactory;48};49goog.inherits(goog.net.WrapperXmlHttpFactory, goog.net.XmlHttpFactory);505152/** @override */53goog.net.WrapperXmlHttpFactory.prototype.createInstance = function() {54'use strict';55return this.xhrFactory_();56};575859/** @override */60goog.net.WrapperXmlHttpFactory.prototype.getOptions = function() {61'use strict';62return this.optionsFactory_();63};646566