On Tuesday, March 10, 2015 at 10:58:42 AM UTC, David Nolen wrote: > As of 0.0-3058 there's a new var *target* which is in fact a Google Closure > define. > > > You can use the following pattern. > > > (if (identical? *target* "nodes") > ...) > > > (if (identical? *target* "default") > ...) > > > HTH, > David > > > On Tue, Mar 10, 2015 at 6:53 AM, Greg <[email protected]> wrote: > 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.
Much appreciated, thank you for that! -- 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.
