xmlhttp.class.js

来自「《JavaScript王者归来》examples.rar」· JavaScript 代码 · 共 58 行

JS
58
字号
# language: JSVM2

/**
 * @fileoverview js.net.XmlHttp class {@link http://jsvm.org/}
 * @file		XmlHttp.jsc
 * @author	Wan Changhua
 * @version	2.01, 10/23/05
 * @since		JSVM2.0
 */

package js.net;

import js.lang.NotSupportException;
import js.lang.System;

/**
 * Create a new XmlHttp instance.
 * Inherit from js.lang.JObject
 * @author	Wan Changhua
 * @version	2.01, 10/23/05
 * @extends JObject
 * @class This is the xmlhttp class.
 * @constructor
 * @throws NotSupportException if current browser does not support XmlHttp/XMLHttpRequest.
 * @return  a <code>XMLHttpRequest</code> instance if the current browser is moz.
 *          a <code>Microsoft.XMLHTTP</code> instance otherwise.
 */
class XmlHttp() {
	this.init();
}

var $p = XmlHttp.prototype;

/**
 * @type XMLHttpRequest
 */
$p.getXMLHttpRequest = function () {
	return this.__request;
}

$p.init = function () {
	this.__request = XmlHttp.create();
}

$p.destroy = function () {
	this.__request = null;
}

/**
 * Retrieves a new XmlHttp instance.
 * @return  a <code>Microsoft.XMLHTTP</code> instance if the current browser is ie.
 *          a <code>XMLHttpRequest</code> instance otherwise.
 * @type XmlHttp
 */
XmlHttp.create = function () {
	return System.RE.getXMLHttpRequest();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?