Q:

Compile-time flags

I am using Google Closure Compiler.
I am writing an app for web use and for use in a Chrome packaged app. 99% of the code is the same. There are a few differences when it comes to things like local storage.
if(CHROME_APP) {
     ...
} else {
     window.localStorage['something'] = true;
}

What is a good setup to allow for (ideally) compile-time choices of compiling the app. I see there is a @define declaration. Should that be used here? If so, how?
(I have in mind something like the existing COMPILED flag.)

A:

@define is the way to go here, but instead of using your own CHROME_APP, why not tie it in with 
http://docs.closure-library.googlecode.com/git/closure_goog_useragent_useragent.js.html
also, since you are using local store as an example, take a look at the ydn library (https://bitbucket.org/ytkyaw/ydn-db/), his compilation level is ok, but did not gel with ours (everything in our system is set to most aggressive)

