aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/clipboard-monitor.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-20 15:10:57 -0400
committerGitHub <noreply@github.com>2020-09-20 15:10:57 -0400
commitd395a2a6bfe33feef467f0e0886a089afccd8438 (patch)
tree5aebeeb3d130960caac29061ffd9dca285f711aa /ext/bg/js/clipboard-monitor.js
parent29890f7625e7a9d0760acb163a9d7181e3d0f08f (diff)
ClipboardReader class (#854)
* Create ClipboardReader class * Use ClipboardReader in Backend * Update ClipboardMonitor to use ClipboardReader * Replace _onApiClipboardImageGet call * Assign clipboard reader browser
Diffstat (limited to 'ext/bg/js/clipboard-monitor.js')
-rw-r--r--ext/bg/js/clipboard-monitor.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/bg/js/clipboard-monitor.js b/ext/bg/js/clipboard-monitor.js
index e7e7378c..4d980e11 100644
--- a/ext/bg/js/clipboard-monitor.js
+++ b/ext/bg/js/clipboard-monitor.js
@@ -20,28 +20,28 @@
*/
class ClipboardMonitor extends EventDispatcher {
- constructor({getClipboard}) {
+ constructor({clipboardReader}) {
super();
this._timerId = null;
this._timerToken = null;
this._interval = 250;
this._previousText = null;
- this._getClipboard = getClipboard;
+ this._clipboardReader = clipboardReader;
}
start() {
this.stop();
// The token below is used as a unique identifier to ensure that a new clipboard monitor
- // hasn't been started during the await call. The check below the await this._getClipboard()
- // call will exit early if the reference has changed.
+ // hasn't been started during the await call. The check below the await call
+ // will exit early if the reference has changed.
const token = {};
const intervalCallback = async () => {
this._timerId = null;
let text = null;
try {
- text = await this._getClipboard();
+ text = await this._clipboardReader.getText();
} catch (e) {
// NOP
}