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() {
var textAreaId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
// start benchmark
benchmarkTimes.HKReadTextArea.timeStart = performance.now(); // starts the main HTML generating function GenerateInnerHTML() and ensures proper checkbox behaviour
InitializeHTMLPopulation(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default);
benchmarkTimes.HKReadTextArea.timeStart = performance.now();
var contents = document.getElementById(textAreaId).value;
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 {
var jsonObject = JSON.parse(contents); // console.log(jsonObject);
if (jsonObject.hasOwnProperty("playerData")) HKCheckCompletion(jsonObject); // console.log(jsonObject);
// end benchmark and show results
if (jsonObject.hasOwnProperty("playerData")) {
HKCheckCompletion(jsonObject);
} // end benchmark and show results
benchmarkTimes.HKReadTextArea.timeEnd = performance.now();
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));
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
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;
if (contents.length) {
// starts the main HTML generating function GenerateInnerHTML() and ensures proper checkbox behaviour
InitializeHTMLPopulation(HK);
try {
let jsonObject = JSON.parse(contents);
// console.log(jsonObject);
if (jsonObject.hasOwnProperty("playerData")) HKCheckCompletion(jsonObject);
// console.log(jsonObject);
if (jsonObject.hasOwnProperty("playerData")) {
HKCheckCompletion(jsonObject);
}
// end benchmark and show results
benchmarkTimes.HKReadTextArea.timeEnd = performance.now();
@ -1697,6 +1699,9 @@ function HKReadTextArea(textAreaId = "") {
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}`);
}
} else {
/* reset timer */
benchmarkTimes.HKReadTextArea.timeStart = 0;
}
}