<commit_before>define([
	'goo/loaders/handlers/TextureHandler',
	'goo/util/PromiseUtils',
	'goo/util/ObjectUtils',
	'goo/util/StringUtils',
	'goo/util/rsvp'
], function (
	TextureHandler,
	PromiseUtils,
	_,
	StringUtils,
	RSVP
) {
	'use strict';

	/**
	 * Ajax helper class
	 * @param {string} rootPath
	 * @param {Object} options
	 */
	function Ajax(rootPath, options) {
		if (rootPath) {
			this._rootPath = rootPath;
			if (rootPath.slice(-1) !== '/') {
				this._rootPath += '/';
			}
		}
		this.options = options || {};
		this._cache = {};
	}

	/**
	 * Prefill ajax cache with data
	 * @param {Object} bundle Pairs of key-configs
	 * @param {boolean} [clear=false] If set to true will overwrite cache, otherwise extend it
	 */
	Ajax.prototype.prefill = function (bundle, clear) {
		if (clear) {
			this._cache = bundle;
		} else {
			_.extend(this._cache, bundle);
		}
	};

	/**
	 * Clears the ajax cache
	 * Is called by {@link DynamicLoader.clear}
	 */
	Ajax.prototype.clear = function () {
		this._cache = {};
	};

	/**
	 * Uses GET to retrieve data at a remote location.
	 * @hidden
	 * @param {Object} options
	 * @param {string} options.url
	 * @returns {Promise} Returns a promise that is resolved and rejected with the XMLHttpRequest.
	 */
	Ajax.prototype.get = function (options) {
		options = options || {};
		var url = options.url || '';

		var method = 'GET';

		var request = new XMLHttpRequest();

		request.open(method, url, true);
		if (options.responseType) {
			request.responseType = options.responseType;
		}

		return PromiseUtils.createPromise(function (resolve, reject) {
			var handleStateChange = function () {
				if (request.readyState === 4) {
					if (request.status >= 200 && request.status <= 299) {
						request.removeEventListener('readystatechange', handleStateChange);
						resolve(request);
					} else {
						request.removeEventListener('readystatechange', handleStateChange);
						reject(request.statusText);
					}
				}
			};

			request.addEventListener('readystatechange', handleStateChange);

			request.send();
		});
	};

	Ajax.ARRAY_BUFFER = 'arraybuffer';
	Ajax.crossOrigin = false;

	var MIME_TYPES = {
		mp4: 'video/mp4',
		ogv: 'video/ogg',
		webm: 'video/webm'
	};

	/**
	 * Loads data at specified path which is returned in a Promise object.
	 *
	 * @param {string} path Path to whatever shall be loaded.
	 * @param {boolean} [reload=false] If set to true, reloads even if url is cached
	 *
	 * @returns {RSVP.Promise} The promise is resolved with the data loaded. If a parser is specified
	 * the data will be of the type resolved by the parser promise.
	 */
	Ajax.prototype.load = function (path, reload) {
		var that = this;
		var path2 = StringUtils.parseURL(path).path;//! AT: dunno what to call this
		var type = path2.substr(path2.lastIndexOf('.') + 1).toLowerCase();

		function typeInGroup(type, group) {<commit_msg>add docs for Ajax.crossOrigin flag<commit_after>define([
	'goo/loaders/handlers/TextureHandler',
	'goo/util/PromiseUtils',
	'goo/util/ObjectUtils',
	'goo/util/StringUtils',
	'goo/util/rsvp'
], function (
	TextureHandler,
	PromiseUtils,
	_,
	StringUtils,
	RSVP
) {
	'use strict';

	/**
	 * Ajax helper class
	 * @param {string} rootPath
	 * @param {Object} options
	 */
	function Ajax(rootPath, options) {
		if (rootPath) {
			this._rootPath = rootPath;
			if (rootPath.slice(-1) !== '/') {
				this._rootPath += '/';
			}
		}
		this.options = options || {};
		this._cache = {};
	}

	/**
	 * Prefill ajax cache with data
	 * @param {Object} bundle Pairs of key-configs
	 * @param {boolean} [clear=false] If set to true will overwrite cache, otherwise extend it
	 */
	Ajax.prototype.prefill = function (bundle, clear) {
		if (clear) {
			this._cache = bundle;
		} else {
			_.extend(this._cache, bundle);
		}
	};

	/**
	 * Clears the ajax cache
	 * Is called by {@link DynamicLoader.clear}
	 */
	Ajax.prototype.clear = function () {
		this._cache = {};
	};

	/**
	 * Uses GET to retrieve data at a remote location.
	 * @hidden
	 * @param {Object} options
	 * @param {string} options.url
	 * @returns {Promise} Returns a promise that is resolved and rejected with the XMLHttpRequest.
	 */
	Ajax.prototype.get = function (options) {
		options = options || {};
		var url = options.url || '';

		var method = 'GET';

		var request = new XMLHttpRequest();

		request.open(method, url, true);
		if (options.responseType) {
			request.responseType = options.responseType;
		}

		return PromiseUtils.createPromise(function (resolve, reject) {
			var handleStateChange = function () {
				if (request.readyState === 4) {
					if (request.status >= 200 && request.status <= 299) {
						request.removeEventListener('readystatechange', handleStateChange);
						resolve(request);
					} else {
						request.removeEventListener('readystatechange', handleStateChange);
						reject(request.statusText);
					}
				}
			};

			request.addEventListener('readystatechange', handleStateChange);

			request.send();
		});
	};

	Ajax.ARRAY_BUFFER = 'arraybuffer';

	/**
	 * Allow cross-origin requests (CORS) for images.
	 * @type {boolean} [crossOrigin=false]
	 */
	Ajax.crossOrigin = false;


	var MIME_TYPES = {
		mp4: 'video/mp4',
		ogv: 'video/ogg',
		webm: 'video/webm'
	};

	/**
	 * Loads data at specified path which is returned in a Promise object.
	 *
	 * @param {string} path Path to whatever shall be loaded.
	 * @param {boolean} [reload=false] If set to true, reloads even if url is cached
	 *
	 * @returns {RSVP.Promise} The promise is resolved with the data loaded. If a parser is specified
	 * the data will be of the type resolved by the parser promise.
	 */
	Ajax.prototype.load = function (path, reload) {
		var that = this;
		var path2 = StringUtils.parseURL(path).path;//! AT: dunno what to call this
		var type = path2.substr(path2.lastIndexOf('.') + 1).toLowerCase();

		function typeInGroup(type, group) {
{'fraction_non_alphanumeric': 0.13810654903291483, 'fraction_numerical': 0.004750593824228029, 'mean_word_length': 3.360207100591716, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6160469', 'n_tokens_mistral': 2137, 'n_tokens_neox': 1849, 'n_words': 521}