I know it is not the done thing but I have a question regarding js*

I have a complex fn defined in a javascript file. it is self contained and 
uses no globals.
It is not currently worth my while to rewrite.

I can use this by doing:
(def my-fn (js* "...file contents with escaped chars..."))

and the my-fn is callable in the defined namespace.

I can use a foreign-libs compiler option but I don't want the function in 
the global namespace.


I would like to define a macro read-js* that reads from a file on the class 
path and allows

(def my-fn (read-js* "js/js-file.js"))

is this possible? I have tried but run into problems with js* - for a start 
I can't find where it is defined.

I have tried:
(def f (js* (from-local-file "js/file.js")))

where from-local-file is a macro that resolves to a string of the file 
contents - but this throws an exception.

Is there a more appropriate way to do this?

for reference - the js file I am using is a very slightly modified form of 
http://www.webtoolkit.info/javascript-md5.html

Thanks for any pointers.

Dave

-- 
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to