reset timer HKReadTextArea

This commit is contained in:
ReznoRMichael 2021-07-21 14:52:39 +02:00
parent 04ba3c131c
commit 22a5421489
3 changed files with 22 additions and 11 deletions

View file

@ -1585,17 +1585,20 @@ function CheckHintsTrue(section, dataObject, playerData, worldData) {
function HKReadTextArea() { function HKReadTextArea() {
var textAreaId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; var textAreaId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
// start benchmark // start benchmark
benchmarkTimes.HKReadTextArea.timeStart = performance.now(); // starts the main HTML generating function GenerateInnerHTML() and ensures proper checkbox behaviour benchmarkTimes.HKReadTextArea.timeStart = performance.now();
InitializeHTMLPopulation(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default);
var contents = document.getElementById(textAreaId).value; var contents = document.getElementById(textAreaId).value;
if (contents.length) { if (contents.length) {
// starts the main HTML generating function GenerateInnerHTML() and ensures proper checkbox behaviour
InitializeHTMLPopulation(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default);
try { try {
var jsonObject = JSON.parse(contents); // console.log(jsonObject); var jsonObject = JSON.parse(contents); // console.log(jsonObject);
if (jsonObject.hasOwnProperty("playerData")) HKCheckCompletion(jsonObject); // console.log(jsonObject); if (jsonObject.hasOwnProperty("playerData")) {
// end benchmark and show results HKCheckCompletion(jsonObject);
} // end benchmark and show results
benchmarkTimes.HKReadTextArea.timeEnd = performance.now(); benchmarkTimes.HKReadTextArea.timeEnd = performance.now();
console.info("HKReadTextArea() time (ms) =", benchmarkTimes.HKReadTextArea.timeEnd - benchmarkTimes.HKReadTextArea.timeStart); console.info("HKReadTextArea() time (ms) =", benchmarkTimes.HKReadTextArea.timeEnd - benchmarkTimes.HKReadTextArea.timeStart);
@ -1604,6 +1607,9 @@ function HKReadTextArea() {
alert("This seems like not a valid Hollow Knight save.\n".concat(error)); alert("This seems like not a valid Hollow Knight save.\n".concat(error));
console.info("This seems like not a valid Hollow Knight save.\n".concat(error)); console.info("This seems like not a valid Hollow Knight save.\n".concat(error));
} }
} else {
/* reset timer */
benchmarkTimes.HKReadTextArea.timeStart = 0;
} }
} }
/** /**

File diff suppressed because one or more lines are too long

View file

@ -1674,18 +1674,20 @@ function HKReadTextArea(textAreaId = "") {
// start benchmark // start benchmark
benchmarkTimes.HKReadTextArea.timeStart = performance.now(); benchmarkTimes.HKReadTextArea.timeStart = performance.now();
// starts the main HTML generating function GenerateInnerHTML() and ensures proper checkbox behaviour
InitializeHTMLPopulation(HK);
let contents = document.getElementById(textAreaId).value; let contents = document.getElementById(textAreaId).value;
if (contents.length) { if (contents.length) {
// starts the main HTML generating function GenerateInnerHTML() and ensures proper checkbox behaviour
InitializeHTMLPopulation(HK);
try { try {
let jsonObject = JSON.parse(contents); let jsonObject = JSON.parse(contents);
// console.log(jsonObject); // console.log(jsonObject);
if (jsonObject.hasOwnProperty("playerData")) HKCheckCompletion(jsonObject); if (jsonObject.hasOwnProperty("playerData")) {
// console.log(jsonObject);
HKCheckCompletion(jsonObject);
}
// end benchmark and show results // end benchmark and show results
benchmarkTimes.HKReadTextArea.timeEnd = performance.now(); benchmarkTimes.HKReadTextArea.timeEnd = performance.now();
@ -1697,6 +1699,9 @@ function HKReadTextArea(textAreaId = "") {
alert(`This seems like not a valid Hollow Knight save.\n${error}`); alert(`This seems like not a valid Hollow Knight save.\n${error}`);
console.info(`This seems like not a valid Hollow Knight save.\n${error}`); console.info(`This seems like not a valid Hollow Knight save.\n${error}`);
} }
} else {
/* reset timer */
benchmarkTimes.HKReadTextArea.timeStart = 0;
} }
} }