Path: blob/trunk/third_party/closure/goog/net/xmlhttpfactory.js
2868 views
// Copyright 2010 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314/**15* @fileoverview Interface for a factory for creating XMLHttpRequest objects16* and metadata about them.17* @author [email protected] (David Barrett-Kahn)18*/1920goog.provide('goog.net.XmlHttpFactory');2122/** @suppress {extraRequire} Typedef. */23goog.require('goog.net.XhrLike');24252627/**28* Abstract base class for an XmlHttpRequest factory.29* @constructor30*/31goog.net.XmlHttpFactory = function() {};323334/**35* Cache of options - we only actually call internalGetOptions once.36* @type {Object}37* @private38*/39goog.net.XmlHttpFactory.prototype.cachedOptions_ = null;404142/**43* @return {!goog.net.XhrLike.OrNative} A new XhrLike instance.44*/45goog.net.XmlHttpFactory.prototype.createInstance = goog.abstractMethod;464748/**49* @return {Object} Options describing how xhr objects obtained from this50* factory should be used.51*/52goog.net.XmlHttpFactory.prototype.getOptions = function() {53return this.cachedOptions_ ||54(this.cachedOptions_ = this.internalGetOptions());55};565758/**59* Override this method in subclasses to preserve the caching offered by60* getOptions().61* @return {Object} Options describing how xhr objects obtained from this62* factory should be used.63* @protected64*/65goog.net.XmlHttpFactory.prototype.internalGetOptions = goog.abstractMethod;666768