1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

common: dont require id in runCommand helper

This commit is contained in:
bbedward
2025-10-15 14:53:23 -04:00
parent ed2afa03f9
commit 59d123a4a1
3 changed files with 10 additions and 10 deletions

View File

@@ -13,18 +13,19 @@ Singleton {
function runCommand(id, command, callback, debounceMs) {
const wait = (typeof debounceMs === "number" && debounceMs >= 0) ? debounceMs : defaultDebounceMs
let procId = id ? id : Math.random()
if (!_procDebouncers[id]) {
if (!_procDebouncers[procId]) {
const t = Qt.createQmlObject('import QtQuick; Timer { repeat: false }', root)
t.triggered.connect(function() { _launchProc(id) })
_procDebouncers[id] = { timer: t, command: command, callback: callback, waitMs: wait }
t.triggered.connect(function() { _launchProc(procId) })
_procDebouncers[procId] = { timer: t, command: command, callback: callback, waitMs: wait }
} else {
_procDebouncers[id].command = command
_procDebouncers[id].callback = callback
_procDebouncers[id].waitMs = wait
_procDebouncers[procId].command = command
_procDebouncers[procId].callback = callback
_procDebouncers[procId].waitMs = wait
}
const entry = _procDebouncers[id]
const entry = _procDebouncers[procId]
entry.timer.interval = entry.waitMs
entry.timer.restart()
}