🐛 Fix: fix repeated upload bug when listening clipboard

This commit is contained in:
萌萌哒赫萝
2023-04-10 19:50:36 +08:00
parent 993d2ac4de
commit 6c18bcb130
4 changed files with 23 additions and 32 deletions

View File

@@ -13,7 +13,6 @@ class ClipboardWatcher extends EventEmitter {
startListening (watchDelay = 500) {
this.stopListening()
console.log('timer', this.timer)
const image = clipboard.readImage()
if (!image.isEmpty()) {
@@ -40,12 +39,10 @@ class ClipboardWatcher extends EventEmitter {
this.lastImage = currentImage
this.emit('change', currentImage)
}, watchDelay)
console.log('start timer', this.timer)
}
stopListening () {
if (this.timer) {
console.log('stop timer')
clearInterval(this.timer)
this.timer = null
}