tweak: forward on-press events
This commit is contained in:
parent
389a730eff
commit
85382bbc28
|
@ -14,11 +14,11 @@
|
||||||
[{:keys [on-press allow-multiple-presses? throttle-duration]} throttle-id]
|
[{:keys [on-press allow-multiple-presses? throttle-duration]} throttle-id]
|
||||||
(if allow-multiple-presses?
|
(if allow-multiple-presses?
|
||||||
on-press
|
on-press
|
||||||
(fn []
|
(fn [event]
|
||||||
(let [id @throttle-id]
|
(let [id @throttle-id]
|
||||||
(when (and id (not (get @throttle id)))
|
(when (and id (not (get @throttle id)))
|
||||||
(swap! throttle assoc id true)
|
(swap! throttle assoc id true)
|
||||||
(on-press)
|
(on-press event)
|
||||||
(js/setTimeout
|
(js/setTimeout
|
||||||
#(swap! throttle dissoc id)
|
#(swap! throttle dissoc id)
|
||||||
(or throttle-duration 500)))))))
|
(or throttle-duration 500)))))))
|
||||||
|
|
Loading…
Reference in New Issue