aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/display-generator.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-02-14 11:00:36 +0200
committerGitHub <noreply@github.com>2020-02-14 11:00:36 +0200
commitc09a3ded1d694887e4e9ff48cc3c387abdbb2065 (patch)
treeaf4a70e78ecc76a9e93ffcd23323f48c9da89d35 /ext/mixed/js/display-generator.js
parente645296b1b5e993355844f2cb2b026b87d05759e (diff)
parent810a7e7d92d15412974810702d954de60453dd31 (diff)
Merge pull request #357 from siikamiika/simplify-display-prepare
Simplify display prepare
Diffstat (limited to 'ext/mixed/js/display-generator.js')
-rw-r--r--ext/mixed/js/display-generator.js26
1 files changed, 4 insertions, 22 deletions
diff --git a/ext/mixed/js/display-generator.js b/ext/mixed/js/display-generator.js
index 3617e546..46f3d17e 100644
--- a/ext/mixed/js/display-generator.js
+++ b/ext/mixed/js/display-generator.js
@@ -20,9 +20,6 @@
class DisplayGenerator {
constructor() {
- this._isInitialized = false;
- this._initializationPromise = null;
-
this._termEntryTemplate = null;
this._termExpressionTemplate = null;
this._termDefinitionItemTemplate = null;
@@ -41,18 +38,10 @@ class DisplayGenerator {
this._tagFrequencyTemplate = null;
}
- isInitialized() {
- return this._isInitialized;
- }
-
- initialize() {
- if (this._isInitialized) {
- return Promise.resolve();
- }
- if (this._initializationPromise === null) {
- this._initializationPromise = this._initializeInternal();
- }
- return this._initializationPromise;
+ async prepare() {
+ const html = await apiGetDisplayTemplatesHtml();
+ const doc = new DOMParser().parseFromString(html, 'text/html');
+ this._setTemplates(doc);
}
createTermEntry(details) {
@@ -304,13 +293,6 @@ class DisplayGenerator {
return node;
}
- async _initializeInternal() {
- const html = await apiGetDisplayTemplatesHtml();
- const doc = new DOMParser().parseFromString(html, 'text/html');
- this._setTemplates(doc);
- this._isInitialized = true;
- }
-
_setTemplates(doc) {
this._termEntryTemplate = doc.querySelector('#term-entry-template');
this._termExpressionTemplate = doc.querySelector('#term-expression-template');