How to use the xmlhttprequest.XMLHttpRequest.apply function in xmlhttprequest

To help you get started, we’ve selected a few xmlhttprequest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github donejs / done-ssr / lib / polyfills / xhr.js View on Github external
var XHR = global.XMLHttpRequest = function() {
	xhr.apply(this, arguments);
	this._hackSend = this.send;
	this.send = XHR.prototype.send;

	this._hackOpen = this.open;
	this.open = XHR.prototype.open;

	// In browsers these default to null
	this.onload = null;
	this.onerror = null;

	// jQuery checks for this property to see if XHR supports CORS
	this.withCredentials = true;
};
github donejs / done-ssr / lib / middleware / xhr.js View on Github external
var XHR = global.XMLHttpRequest = function() {
		xhr.apply(this, arguments);
		this._hackSend = this.send;
		this.send = XHR.prototype.send;

		var oldOpen = this.open;
		this.open = function() {
			var req = global.doneSsr.request;
			var baseUri = req.url || "";
			if ( req.protocol && req.get ) {
				baseUri = req.protocol + '://' + req.get( "host" ) + baseUri;
			}
			var args = Array.prototype.slice.call(arguments);
			var reqURL = args[1];

			if ( reqURL && !fullUrl.test( reqURL ) ) {
				args[1] = url.resolve( baseUri, reqURL );
			}
github stealjs / steal-tools / build / open / open.js View on Github external
var ShimXHR = function(){
	XMLHttpRequest.apply(this, arguments);

	var oldOpen = this.open;
	this.open = function(method, url){
		url = "file://" + process.cwd() + "/" + url;
		arguments[1] = url;
		return oldOpen.apply(this, arguments);
	};
};

xmlhttprequest

XMLHttpRequest for Node

MIT
Latest version published 9 years ago

Package Health Score

69 / 100
Full package analysis