<commit_before>/*
==================================================================================================
	Lowland - JavaScript low level functions
	Copyright (C) 2012 <NAME>
==================================================================================================
*/

/**
 * #require(ext.sugar.Object)
 * #require(ext.sugar.Array)
 */

(function(window) {
	var timer = null;
	var registration = [];
	var callstack = [];
	var schedule = {};
	var runState = "stop";
	var flushCallback = [];
	
	/**
	 * Generic queue manager supporting simple dependency dissolving.
	 */
	core.Module("lowland.QueueManager", {
		scheduleFlush : function() {
			if (!timer) {
				timer = window.setTimeout(this.__flush.bind(this), 0);
			}
		},
		
		flush : function() {
			if (timer) {
				window.clearTimeout(timer);
			}
			
			this.__flush();
		},
		
		register : function(name, callback, context, dependsOn) {
			if (jasy.Env.getValue("debug")) {
				if (!name) {
					throw new Error("Parameter name not set");
				}
				if (!callback) {
					throw new Error("Parameter callback not set");
				}
			}
			
			if (timer) {
				window.clearTimeout(this.timer);
			}
			
			// Make list
			registration.push({
				name: name,
				callback: callback,
				content: context,
				dependsOn: dependsOn<commit_msg>Move from setTimeout to lazy in queuing<commit_after>/*
==================================================================================================
	Lowland - JavaScript low level functions
	Copyright (C) 2012 <NAME>
==================================================================================================
*/

/**
 * #require(ext.sugar.Object)
 * #require(ext.sugar.Array)
 */

(function(window) {
	var timer = null;
	var registration = [];
	var callstack = [];
	var schedule = {};
	var runState = "stop";
	var flushCallback = [];
	
	/**
	 * Generic queue manager supporting simple dependency dissolving.
	 */
	core.Module("lowland.QueueManager", {
		scheduleFlush : function() {
			if (!timer) {
				timer = lowland.ext.Function.lazy(this, this.__flush);
			}
		},
		
		flush : function() {
			if (timer) {
				lowland.ext.Function.cancelLazy(timer);
			}
			
			this.__flush();
		},
		
		register : function(name, callback, context, dependsOn) {
			if (jasy.Env.getValue("debug")) {
				if (!name) {
					throw new Error("Parameter name not set");
				}
				if (!callback) {
					throw new Error("Parameter callback not set");
				}
			}
			
			if (timer) {
				window.clearTimeout(this.timer);
			}
			
			// Make list
			registration.push({
				name: name,
				callback: callback,
				content: context,
				dependsOn: dependsOn
{'fraction_non_alphanumeric': 0.2727614747930775, 'fraction_numerical': 0.003386004514672686, 'mean_word_length': 3.491554054054054, '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': '3667273', 'n_tokens_mistral': 932, 'n_tokens_neox': 727, 'n_words': 175}