summaryrefslogtreecommitdiff
path: root/ext/bg/js/anki.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/anki.js')
-rw-r--r--ext/bg/js/anki.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/ext/bg/js/anki.js b/ext/bg/js/anki.js
index b1e1f7b4..182b4ded 100644
--- a/ext/bg/js/anki.js
+++ b/ext/bg/js/anki.js
@@ -16,30 +16,30 @@
*/
class AnkiConnect {
- constructor(server) {
+ constructor() {
this._enabled = false;
- this._server = server;
+ this._server = null;
this._localVersion = 2;
this._remoteVersion = 0;
this._versionCheckPromise = null;
}
- setServer(server) {
- this._server = server;
- }
-
- getServer() {
+ get server() {
return this._server;
}
- setEnabled(enabled) {
- this._enabled = enabled;
+ set server(value) {
+ this._server = value;
}
- isEnabled() {
+ get enabled() {
return this._enabled;
}
+ set enabled(value) {
+ this._enabled = value;
+ }
+
async addNote(note) {
if (!this._enabled) { return null; }
await this._checkVersion();
@@ -76,6 +76,10 @@ class AnkiConnect {
return await this._invoke('guiBrowse', {query});
}
+ async guiBrowseNote(noteId) {
+ return await this.guiBrowse(`nid:${noteId}`);
+ }
+
async storeMediaFile(fileName, dataBase64) {
if (!this._enabled) {
throw new Error('AnkiConnect not enabled');