User:Bosco/Unsigned helper.js: Difference between revisions

From Test Wiki
Content deleted Content added
doAddUnsignedTemplate: drop line breaks from selection
reduce debug logging
Line 3: Line 3:
*/
*/
(function () {
(function () {
const DEBUG = false;
const LOG_PREFIX = `[Unsigned Helper]:`;
const LOG_PREFIX = `[Unsigned Helper]:`;


Line 107: Line 108:
this.#api.get(intervalQuery).then(async (response) => {
this.#api.get(intervalQuery).then(async (response) => {
try {
try {
if (DEBUG) {
// debug(`${logMsgPrefix} R =`, response);
debug(`${logMsgPrefix} R =`, response);
}
const interval = this.#createIntervalFromResponse(response);
const interval = this.#createIntervalFromResponse(response);
this.#historyIntervalPromises[startIndex] = Promise.resolve(interval);
this.#historyIntervalPromises[startIndex] = Promise.resolve(interval);
Line 190: Line 193:
try {
try {
const interval = await this.#loadInterval(intervalIndex);
const interval = await this.#loadInterval(intervalIndex);
if (DEBUG) {
debug(`loadRevision: loaded the interval#${intervalIndex} with revisions: (length=${interval?.revisions?.length}) ${this.#revisionsToString(interval?.revisions)}`);
debug(`loadRevision: loaded the interval#${intervalIndex} with revisions: (length=${interval?.revisions?.length}) ${this.#revisionsToString(interval?.revisions)}`);
}
if (interval == undefined) {
if (interval == undefined) {
resolve(undefined);
resolve(undefined);
Line 196: Line 201:
}
}
const indexInInterval = this.#indexToIndexInInterval(index);
const indexInInterval = this.#indexToIndexInInterval(index);
if (DEBUG) {
debug(`loadRevision: from the above interval, looking at [${indexInInterval}]`);
debug(`loadRevision: from the above interval, looking at [${indexInInterval}]`);
}
const theRevision = interval.revisions[indexInInterval];
const theRevision = interval.revisions[indexInInterval];
debug('loadRevision: loaded revision', index, theRevision);
debug('loadRevision: loaded revision', index, theRevision);