How to refer to nodejs Buffer in clojurescript ?

2011-12-13 Thread Sun Ning
Hi, all I'm trying to use clojurescript compiled to nodejs. I ran into a problem with nodejs Buffer class, which doesn't have a namespace. I tried different ways to refer Buffer: (def b (Buffer. 1)) compiled to: b = new mynamespace.Buffer(1) this leads to an undefined error on runtime If I

Re: How to refer to nodejs Buffer in clojurescript ?

2011-12-13 Thread Stuart Sierra
I don't know if this works for this case, but the special namespace js allows access to raw JavaScript objects. Try js/Buffer -S -- 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

Re: How to refer to nodejs Buffer in clojurescript ?

2011-12-13 Thread sunng
Thank you. It works now. However, I think this is an issue of compiling clojurescript to nodejs. *Buffer* is a nodejs specific function like *require* (a nodejs function). So maybe we'd better use it like the way we use require: (cljs.nodejs/require). When compiled to nodejs, require is added to