Skip to content

Commit

Permalink
Apply minor improvements
Browse files Browse the repository at this point in the history
Change-Id: I9a7260aae0ad41765b5db9710798e9313886123e
  • Loading branch information
jwbth committed Jun 2, 2024
1 parent 23f5c08 commit a3e1ab4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Redesigned talk pages, with author and date displayed on top of comments (opt-in) and thin lines denoting threads
* Handling "outdent" templates
* Collapsible (and autocollapsible) threads
* Navigating sibling threads by holding the middle button
* Navigating sibling threads by holding the middle mouse button
* Comment timestamps in local time and arbitrary format, including relative
* Highlighting and navigating new comments (via the navigation panel or the table of contents)
* Highlighting own comments
Expand Down
19 changes: 18 additions & 1 deletion src/cd.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,21 @@
*/
self.convenientDiscussions ||= {};

export default self.convenientDiscussions;
// Idk how do I make VS Code understand that the export of this module maps to the
// convenientDiscussions namespace. JSDoc generates the contents of that namespace correctly, but VS
// Code doesn't infer types from it. So I just manually type (again) the types of a limited number
// of properties here.

/**
* @typedef ConvenientDiscussions
* @property {import('./pageRegistry').Page} page
* @property {import('./userRegistry').User} user
* @private
*/

/**
* @type {ConvenientDiscussions}
*/
const convenientDiscussions = self.convenientDiscussions;

export default convenientDiscussions;
8 changes: 4 additions & 4 deletions src/pageRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ import { findFirstTimestamp, maskDistractingCode } from './utils-wikitext';
/**
* Class representing a wiki page (a page for which the
* {@link https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#All_pages_(user/page-specific) wgIsArticle}
* config value is `true`) in both of its facets – a rendered instance (for the current page) and
* an entry in the database with data and content.
* config value is `true`) in both of its facets – a rendered instance (for the current page) and an
* entry in the database with data and content.
*
* To access the constructor, use {@link module:pageRegistry.get} (it is only exported for means of
* code completion).
* To create an instance, use {@link module:pageRegistry.get} (the constructor is only exported for
* means of code completion).
*/
export class Page {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/updateChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { loadUserGenders } from './utils-api';
import { calculateWordOverlap, keepWorkerSafeValues } from './utils-general';
import visits from './visits';

// FIXME: Make this into a singleton (object) without inner module variables, so that it emits with
// TODO: Make this into a singleton (object) without inner module variables, so that it emits with
// this.emit(). Move worker-related stuff to controller.

const revisionData = {};
Expand Down
5 changes: 3 additions & 2 deletions src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ function onMessageFromWindow(e) {
}

if (message.type === 'parse') {
debug.startTimer('worker');
const timerLabel = `worker: processing revision ${message.revisionId}`;
debug.startTimer(timerLabel);

cd.g = message.g;
cd.config = message.config;
Expand All @@ -528,7 +529,7 @@ function onMessageFromWindow(e) {
sections: cd.sections,
});

debug.stopTimer('worker');
debug.stopTimer(timerLabel);
debug.logAndResetEverything();
}
}
Expand Down

0 comments on commit a3e1ab4

Please sign in to comment.