Make sure on-set is valid before allowing change of Reaction

This commit is contained in:
Dan Holmsand 2015-09-14 21:11:33 +02:00
parent 87758ae396
commit ce1486a7cd
1 changed files with 2 additions and 2 deletions

View File

@ -285,10 +285,10 @@
IReset
(-reset! [a newval]
(assert (ifn? on-set) "Reaction is read only.")
(let [oldval state]
(set! state newval)
(when (some? on-set)
(on-set oldval newval))
(on-set oldval newval)
(-notify-watches a oldval newval)
newval))