Last active
September 22, 2015 14:46
-
-
Save mbertheau/3a90c1bc46ea660bc8ea to your computer and use it in GitHub Desktop.
My first macro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro defhandler | |
[handler-name argv body] | |
`(re-frame.core/register-handler | |
~(keyword (name handler-name)) | |
(comp re-frame.core/debug re-frame.core/trim-v) | |
(fn ~(if (> (count argv) 1) | |
(vec (list (first argv) (vec (rest argv)))) | |
argv) | |
~body))) |
style check is complaining about several pep8 issues!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a macro. There aren't many like it and this one is mine. And my first. Review comments are very welcome! :)
(If you want to know what this is about: https://github.com/Day8/re-frame#event-handlers)