<commit_before>import ControlProfile from "../util/io/ControlProfile";

import * as GameControllereRegistry from "../registries/GameControllerRegistry";

import { AbstractControllable } from "../model/abstracts/AbstractControllable";

export default function WhenDone(cbName, ...cbArgs: any[]) {
	return function (targetClass: ControlProfile<AbstractControllable>, methodName: string, descriptor: PropertyDescriptor) {
		
		const finishedCB = targetClass[cbName];
		const originalMethod = descriptor.value; 

		let timeout;

		descriptor.value =  function (...args: any[]) {

			if(timeout) window.clearTimeout(timeout);
			timeout = window.setTimeout(()=>{
				finishedCB.apply(this, cbArgs);
			}, 100)

			const result = originalMethod.apply(this, args);
			const r = JSON.stringify(result);
			return result;
		}

		return descriptor;
	}
};<commit_msg>removed dead code<commit_after>import ControlProfile from "../util/io/ControlProfile";

import * as GameControllereRegistry from "../registries/GameControllerRegistry";

import { AbstractControllable } from "../model/abstracts/AbstractControllable";

export default function WhenDone(cbName, ...cbArgs: any[]) {
	return function (targetClass: ControlProfile<AbstractControllable>, methodName: string, descriptor: PropertyDescriptor) {
		
		const finishedCB = targetClass[cbName];
		const originalMethod = descriptor.value; 

		let timeout;

		descriptor.value =  function (...args: any[]) {

			if(timeout) window.clearTimeout(timeout);
			timeout = window.setTimeout(()=>{
				finishedCB.apply(this, cbArgs);
			}, 100)

			const result = originalMethod.apply(this, args);
			return result;
		}

		return descriptor;
	}
};
{'fraction_non_alphanumeric': 0.12447885646217986, 'fraction_numerical': 0.00357355568790947, 'mean_word_length': 4.77319587628866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5386184', 'n_tokens_mistral': 520, 'n_tokens_neox': 458, 'n_words': 113}