Guest User

macroman

a guest
Dec 12th, 2013
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. (defn- munged-symbol
  3.   [& strs]
  4.   (symbol (cljs.compiler/munge (apply str strs))))
  5.  
  6.  
  7. (defmacro observable
  8.   "It is a macro that calls observable-fn we
  9.   need it because we need to call it in compilation
  10.   phase because of namespace resolution , wee need ns mungling
  11.  
  12.   Accepts name(str) or name and value
  13.   "
  14.   ([name]
  15.      `(observable-fn
  16.        ~(munged-symbol *cljs-ns* "." name)
  17.        nil))
  18.   ([name value]
  19.      `(observable-fn
  20.        ~(munged-symbol *cljs-ns* "." name)
  21.        ~value)))
Advertisement
Add Comment
Please, Sign In to add comment