This commit is contained in:
Alexander Drozdov
2020-02-20 16:35:02 +02:00
parent ee2d884f87
commit 0df650592c
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -1,9 +1,15 @@
import { clipboard } from 'electron'
import { TAG_RARITY } from '../components/parser/constants'
export async function pollClipboard (delay: number, limit: number): Promise<string> {
const textBefore = clipboard.readText()
let textBefore = clipboard.readText()
let elapsed = 0
if (textBefore.startsWith(TAG_RARITY)) {
textBefore = ''
clipboard.writeText('')
}
return new Promise((resolve, reject) => {
function poll () {
const textAfter = clipboard.readText()
+1 -1
View File
@@ -23,7 +23,7 @@ export function setupShortcuts () {
ioHook.registerShortcut([KEY_CTRL, KEY_D], () => {
if (!isPollingClipboard) {
isPollingClipboard = true
pollClipboard(32, 1750)
pollClipboard(32, 1000)
.then(async (clipboard) => {
win.webContents.send('price-check', clipboard)
poeWindowId = await windowManager.getActiveWindowId()