Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/third_party/closure/goog/net/wrapperxmlhttpfactory.js
4050 views
1
/**
2
* @license
3
* Copyright The Closure Library Authors.
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
/**
8
* @fileoverview Implementation of XmlHttpFactory which allows construction from
9
* simple factory methods.
10
*/
11
12
goog.provide('goog.net.WrapperXmlHttpFactory');
13
14
/** @suppress {extraRequire} Typedef. */
15
goog.require('goog.net.XhrLike');
16
goog.require('goog.net.XmlHttpFactory');
17
18
19
20
/**
21
* An xhr factory subclass which can be constructed using two factory methods.
22
* This exists partly to allow the preservation of goog.net.XmlHttp.setFactory()
23
* with an unchanged signature.
24
* @param {function():!goog.net.XhrLike.OrNative} xhrFactory
25
* A function which returns a new XHR object.
26
* @param {function():!Object} optionsFactory A function which returns the
27
* options associated with xhr objects from this factory.
28
* @extends {goog.net.XmlHttpFactory}
29
* @constructor
30
* @final
31
*/
32
goog.net.WrapperXmlHttpFactory = function(xhrFactory, optionsFactory) {
33
'use strict';
34
goog.net.XmlHttpFactory.call(this);
35
36
/**
37
* XHR factory method.
38
* @type {function() : !goog.net.XhrLike.OrNative}
39
* @private
40
*/
41
this.xhrFactory_ = xhrFactory;
42
43
/**
44
* Options factory method.
45
* @type {function() : !Object}
46
* @private
47
*/
48
this.optionsFactory_ = optionsFactory;
49
};
50
goog.inherits(goog.net.WrapperXmlHttpFactory, goog.net.XmlHttpFactory);
51
52
53
/** @override */
54
goog.net.WrapperXmlHttpFactory.prototype.createInstance = function() {
55
'use strict';
56
return this.xhrFactory_();
57
};
58
59
60
/** @override */
61
goog.net.WrapperXmlHttpFactory.prototype.getOptions = function() {
62
'use strict';
63
return this.optionsFactory_();
64
};
65
66