Skip to content

Instantly share code, notes, and snippets.

@mbertheau
Last active September 22, 2015 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbertheau/3a90c1bc46ea660bc8ea to your computer and use it in GitHub Desktop.
Save mbertheau/3a90c1bc46ea660bc8ea to your computer and use it in GitHub Desktop.
My first macro
(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)))
@mbertheau
Copy link
Author

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)

@Jyggafey
Copy link

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