aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/backend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-07 21:41:45 -0500
committerGitHub <noreply@github.com>2020-03-07 21:41:45 -0500
commitb8eb5e6016834cc751c973239e1e4604fe9799ee (patch)
tree34001835d0efa086a32e50fc8fb70fee4b7f4795 /ext/bg/js/backend.js
parent4b0dfa92aaa9e088c2f59edb3adcb89f0b3c1053 (diff)
parentba64f34df19d446cbe5b8ec2e367d4f6a4d1061f (diff)
Merge pull request #397 from toasted-nutbread/clipboard-monitor-refactor2
Clipboard monitor refactor
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r--ext/bg/js/backend.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 4595dbb3..04bf240d 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -30,7 +30,7 @@ class Backend {
this.translator = new Translator();
this.anki = new AnkiNull();
this.mecab = new Mecab();
- this.clipboardMonitor = new ClipboardMonitor();
+ this.clipboardMonitor = new ClipboardMonitor({getClipboard: this._onApiClipboardGet.bind(this)});
this.options = null;
this.optionsSchema = null;
this.defaultAnkiFieldTemplates = null;
@@ -117,7 +117,7 @@ class Backend {
chrome.tabs.create({url: chrome.runtime.getURL('/bg/guide.html')});
}
- this.clipboardMonitor.onClipboardText = this._onClipboardText.bind(this);
+ this.clipboardMonitor.on('change', this._onClipboardText.bind(this));
this._sendMessageAllTabs('backendPrepared');
const callback = () => this.checkLastError(chrome.runtime.lastError);
@@ -155,7 +155,7 @@ class Backend {
}
}
- _onClipboardText(text) {
+ _onClipboardText({text}) {
this._onCommandSearch({mode: 'popup', query: text});
}