summaryrefslogtreecommitdiff
path: root/dev/translator-vm.js
diff options
context:
space:
mode:
authorCashew <52880648+Scrub1492@users.noreply.github.com>2023-12-19 12:44:40 +0900
committerGitHub <noreply@github.com>2023-12-19 03:44:40 +0000
commitc661eafa7d57c32e33e51dd6eb787b97832e97f0 (patch)
tree1a68a563f9f1960d528595d6b33f74cb506bd77e /dev/translator-vm.js
parenteb7bf9542c92ea7937d4b4a699ae2d47270da96b (diff)
Add some JSDoc annotations to describe code functionality. (#355)
* lesen-tan initial commit * update README.md * tidy up code * opt for Map<K, V> instead of Object * Document dev/* * add docs for deinflector.js * update deinflector example * Annotate * Revert "Merge branch 'development' of https://github.com/Scrub1492/lesen-tan into development" This reverts commit b92348f702bc031b36f24462adfa940d17f9ecdd, reversing changes made to 3255e6d963281af3533dcf1e893df39032d29fec. * Lint error fix * Lint error fix
Diffstat (limited to 'dev/translator-vm.js')
-rw-r--r--dev/translator-vm.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/dev/translator-vm.js b/dev/translator-vm.js
index 60777da0..f407e57e 100644
--- a/dev/translator-vm.js
+++ b/dev/translator-vm.js
@@ -32,6 +32,9 @@ vi.mock('../ext/js/language/dictionary-importer-media-loader.js', async () => aw
const dirname = path.dirname(fileURLToPath(import.meta.url));
+/**
+ * Translator Virtual Machine.
+ */
export class TranslatorVM {
constructor() {
/** @type {import('dev/vm').PseudoChrome} */
@@ -55,15 +58,19 @@ export class TranslatorVM {
this._dictionaryName = null;
}
- /** @type {Translator} */
+ /**
+ * Returns this VM's translator.
+ * @type {Translator}
+ */
get translator() {
if (this._translator === null) { throw new Error('Not prepared'); }
return this._translator;
}
/**
- * @param {string} dictionaryDirectory
- * @param {string} dictionaryName
+ * Initialize this translator VM from a dictionary.
+ * @param {string} dictionaryDirectory Directory of the dictionary files.
+ * @param {string} dictionaryName Name of the dictionary.
*/
async prepare(dictionaryDirectory, dictionaryName) {
// Dictionary