64 lines
2.1 KiB
HTML
64 lines
2.1 KiB
HTML
<script src="ecma/ErrorsManager.ecma.js"></script>
|
|
<script>
|
|
|
|
errors_manager = new ErrorsManager();
|
|
|
|
console.log(errors_manager.to_string(105));
|
|
console.log(errors_manager.to_array(105));
|
|
console.log(errors_manager.to_array_binary(105));
|
|
console.log(errors_manager.process(105, "0123456789abcdef".split("").map((_, i) => "error_message_" + i)));
|
|
|
|
|
|
console.log(errors_manager.bits(105));
|
|
console.log(errors_manager.bits("pB"));
|
|
console.log(errors_manager.bits([41, 1]));
|
|
|
|
options = [-10, -5, -3, -1, 0, 1, 3, 5, 10];
|
|
filler = "";
|
|
results = [];
|
|
|
|
while(filler.length < 30)
|
|
filler += " ";
|
|
|
|
format = (value, characters) => " " + (
|
|
JSON.stringify(value).replace(/,/g, ", ") + filler
|
|
).slice(0, characters) + " ";
|
|
|
|
[105, "pB", [41, 1]].forEach((value, i) => options.forEach(bits => {
|
|
|
|
const new_value = errors_manager.bitwise(value, bits);
|
|
|
|
results.push([
|
|
format(value, 7),
|
|
format(errors_manager.to_array_binary(value), 20),
|
|
format(bits, 4),
|
|
format(new_value, 12),
|
|
format(errors_manager.to_array_binary(new_value), 30)
|
|
]);
|
|
// console.log(results[results.length - 1]);
|
|
|
|
}));
|
|
|
|
console.log(results);
|
|
// console.log(results.map(result => result.join("|")).join("\n"));
|
|
|
|
// if ('speechSynthesis' in window) {
|
|
// console.log("CARGANDO...");
|
|
// window.speechSynthesis.onvoiceschanged = () => {
|
|
// console.log("CARGADO");
|
|
// const voices = window.speechSynthesis.getVoices();
|
|
// console.log(voices);
|
|
// const selectedVoice = voices.find(voice => voice.name === 'Google español'); // Ejemplo de selección de voz
|
|
|
|
// // Crear un objeto de síntesis de voz
|
|
// const utterance = new SpeechSynthesisUtterance('Hola, mundo!');
|
|
// utterance.voice = selectedVoice;
|
|
|
|
// // Iniciar la síntesis de voz
|
|
// window.speechSynthesis.speak(utterance);
|
|
// };
|
|
// } else {
|
|
// console.error('La API de SpeechSynthesis no es compatible con este navegador.');
|
|
// };
|
|
|
|
</script> |