I have a project which targets both Node.js and the browser - the vast majority 
of code is shared and kept in the 'src' folder, with anything that needs to 
differ being held in 'src-client' and 'src-server'. It's getting a little 
clunky to maintain this, though, so I'm hoping to move everything to a single 
folder and use a macro to detect whether or not it's built with Node extensions.

Essentially, I want to allow something like this:
(def logger
    (client-or-server
        js/log ; Use a globally namespaced library on the client
        (nodejs/require "loglevel") ; Use a 'require' statement on the server
))

But I'm finding myself a little lost in documentation when it comes to safely 
detecting the existence of 'cljs.nodejs', and I'm wondering if it might be a 
bad idea for as-yet unforeseen reasons? 

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to