Skip to content

Instantly share code, notes, and snippets.

@mbertheau
Last active September 22, 2015 14:46
Show Gist options
  • Select an option

  • Save mbertheau/3a90c1bc46ea660bc8ea to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown
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
Copy Markdown

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