Hi,

A little confused around how to properly work with external libraries. I heard 
the news about the CLJSJS stuff and have the aim of making a package out of a 
very simple js-lib: https://github.com/t4t5/sweetalert

A few questions have surged:

1. What is the preferred way to include an external js-lib?
I used foreign-lib but I guess a CDN or similar could be used as well.

2. Can/Should the library be munged by Advanced optimizations?
I successfully included the library with foreign-libs and defined a namespace 
for it. But when I look in the with advanced mode generated js the library is 
included in full text, no optimizations done whatsoever.

3. Should I modify the library to have its own namespace?
It currently uses 

;(function(window, document, undefined) {

... code ...

})(window, document);

so not every function is attached to the global namespace but the return 
function: sweetAlert() is. Should I somehow make this its own namespace and 
would anyone suggest how it should be done?

4. If I should make its own namespace, would I then need an externs file?
Since the function sweetAlert is added directly to the global namespace it can 
successfully be reached by using js/sweetAlert since this does not seem to be 
modified by the closure optimizer. But I guess this would change if I had to 
refer it from a namespace like sweet-alert/alert or something.

-- 
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