I have not run your fade example, but I think the (.play anim) is to
blame. You should use (. anim (play)). The explanation for this is at
https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure
in the 'Host Interop' section.

An example is at 
https://github.com/clojure/clojurescript/blob/master/samples/twitterbuzz/src/twitterbuzz/core.cljs#L235

On Aug 30, 8:52 pm, atucker <agjf.tuc...@googlemail.com> wrote:
> Thank you that works!  But I see what you mean about rough edges, it's
> not for the faint-hearted.
>
> So for example I have no idea how to find out why fading works with
> this JavaScript:
>
> goog.require('goog.dom');
> goog.require('goog.fx.dom');
>
> function fade() {
>     var kurdt = goog.dom.getElement("kurdt");
>     var anim = new goog.fx.dom.FadeOut(kurdt, 1234);
>     anim.play();
>     goog.dom.appendChild(document.body, goog.dom.createDom('h1', 0,
> anim.duration.toString()));
>
> }
>
> but not with this ClojureScript:
>
> (ns fade (:require [goog.dom :as dom]
>                    [goog.fx.dom :as fx-dom]
>                    [goog.fx.dom.FadeOut :as fx-dom-FadeOut]))
>
> (defn ^:export main []
>   (let [kurdt (dom/getElement "kurdt")
>         anim (fx-dom/FadeOut. kurdt 1234)]
>     (.play anim)
>     (dom/appendChild (.body (dom/getDocument)) (dom/createDom "h1" 0
> (str (.duration anim))))))
>
> They both manage to print out "1234".
>
> Cheers Alistair
>
> On Aug 30, 1:38 pm, "Gijs S." <gijsstuur...@gmail.com> wrote:
>
> > Hi,
>
> > I have run into a similar problem. The problem is something with the
> > "require" and namespaces in JavaScript. The following worked for me:
>
> > (ns example.example
> > (:require [goog.fx.Dragger :as unused-alias]))
>
> > And then to call the Dragger constructor:
> > (goog.fx.Dragger. <element>)
>
> > In the twitterbuzz example in the clojurescript source there is a
> > similar case with goog.net.Jsonp.:
> > (ns twitterbuzz.core
> > (:require ....
> > [goog.net.Jsonp :as jsonp] ;; the alias jsonp is never used
> > ...))
>
> > And later in the code:
> > (goog.net.Jsonp. twitter-uri)
>
> > from twitterbuzz/corecljs 
> > athttps://github.com/clojure/clojurescript/blob/master/samples/twitterb...
>
> > This seems to be a rough edge around the namespace support in
> > ClojureScript.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to