<commit_before>function createView(namespace, selector, params) {
	
	var targetSelector = selector;
	var html = null;
	var args = null;

	var socket = io.connect('http://' + document.domain + ':' + location.port + namespace, {});

	socket.on('connect', function(data) {
		socket.emit('request_view', {});
	});
	
	socket.on('view', function(data) {
		if (data.html) {
			html = Handlebars.compile(data.html);
		}
		if (data.args) {
			args = data.args;
		}
		updateView();
	});

	function requestView() {
		socket.emit("request_view", {});
	}

	function updateView() {
		if (targetSelector != null && html != null) {
			var substHtml = html(args);
			$(targetSelector).html(substHtml);
		}
	}

	return {<commit_msg>Bug fixes in the client. Allow for nested views.<commit_after>function createView(namespace, target, params) {
	
	var rawHtml = null;
	var compiledHtml = null;
	var processedHtml = null;
	var args = null;
	var innerViews = {};

	var socket = io.connect('http://' + document.domain + ':' + location.port + namespace, {});

	socket.on('connect', function(data) {
		socket.emit('request_view', {});
	});
	
	socket.on('view', function(data) {
		if (data.args) {
			args = data.args;
		}
		if (data.innerViews) {
			Object.keys(data.innerViews).forEach(function (name) {
				var view = data.innerViews[name];
				var namespace = view.namespace;
				var randomId = "innerview-" + Math.random().toString(36).substring(2);
				var tempHtml = '<div id="' + randomId + '"></div>';
				args[name] = tempHtml;
				console.log("Will load " + namespace + " into " + randomId);

				var loadInner = function(html) {
					$("#" + randomId).html(html);
				}

				var viewObj = createView(namespace, loadInner, {});
				viewObj.render();
				innerViews[name] = viewObj;

			});
		}
		if (data.html) {
			rawHtml = data.html;
			compiledHtml = Handlebars.compile(data.html);
		}
		if (compiledHtml) {
			processedHtml = compiledHtml(args);
		}
		updateView();
	});

	function requestView() {
		socket.emit("request_view", {});
	}

	function updateView() {
		if (processedHtml != null && target != null) {
			if (typeof target === 'string') {
				$(target).html(processedHtml);
			}
			else if (typeof target === 'function') {
				target(processedHtml);
			}
		}
	}

	return {
{'fraction_non_alphanumeric': 0.17393218846323205, 'fraction_numerical': 0.001321003963011889, 'mean_word_length': 3.507936507936508, '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': '3359904', 'n_tokens_mistral': 868, 'n_tokens_neox': 744, 'n_words': 160}