[ClojureScript] Html structure in OM's app state

2014-09-07 Thread youshould
I am using om library and would like to store html structure in app state's 
atom than generate dom/* elements in app-view on the fly.

Here is one of attempts in implementing this functionality but is not working.
https://gist.github.com/unfoldyourmind/41e287cfb14e68e39cb0.

Why it does not work and is it even possible?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
ClojureScript group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] clojurescript wrapping javascript function call twice.

2014-09-07 Thread Bobby Harris
I'm getting unexpected results in some generated javascript:

My clojurescript looks like:

 (let  [video (.getElementById js/document video)
   _ (js/alert video)
   success (fn [stream] (aset video src (.createObjectURL (.-URL 
js/window) stream)))
   error (fn [err] (. js/console (log (str error: ) err)))
   params #js {:audio true :video true}] 
(.webkitGetUserMedia js/navigator params success error)))



Which is generating the folowing javascript:

var video = document.getElementById(video);
var ___$2 = alert(video);
var on_success = function(video, ___$2, active, completed, ___$1, 
map__19073, map__19073__$1, q, map__19068, map__19068__$1, app, todos) {
  return function(stream) {
return video[src] = window.URL.createObjectURL(stream);
  };
}(video, ___$2, active, completed, ___$1, map__19073, 
map__19073__$1, q, map__19068, map__19068__$1, app, todos);
var on_error = function(video, ___$2, on_success, active, 
completed, ___$1, map__19073, map__19073__$1, q, map__19068, map__19068__$1, 
app, todos) {
  return function(err) {
return console.log([cljs.core.str(navigator.getUserMedia 
error: )].join(), err);
  };
}(video, ___$2, on_success, active, completed, ___$1, map__19073, 
map__19073__$1, q, map__19068, map__19068__$1, app, todos);
var constraints = {video:true, audio:false};
return navigator.webkitGetUserMedia(constraints, on_success, 
on_error);
  };

As I'm seeing it, the generated on-success function is just wrong... it doesn't 
have the interface that i would be expecting.

Any ideas?

Thanks in advance!

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
ClojureScript group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] clojurescript wrapping javascript function call twice.

2014-09-07 Thread Francis Avila
The on_success function is not the outer wrapper function but the inner 
returned function. The outer function is immediately-invoked, not assigned to 
on_success.

The reason you see so many function wrappers in the generated js is that js 
provides no other way of introducing a new scope. Advanced compilation will get 
rid of most of these wrappers.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
ClojureScript group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.