Open ddevault opened 10 years ago
What do you mean? Slimit should mangle only non-globally-accessible function names and variables. So functions that you don't want accessed will be mangled, you can just wrap in IIFE: http://benalman.com/news/2010/11/immediately-invoked-function-expression/
Ah, here's the thing. I'm using web workers. I'm moving the name of internal functions, as strings, between the UI and the worker.
Sounds interesting. Can you provide an example?
Here's the worker in question (it's in CoffeeScript): https://github.com/MediaCrush/MediaCrush/blob/master/scripts/worker.coffee
The worker can post messages back with execute
, which contains code to be executed on the UI thread: https://github.com/MediaCrush/MediaCrush/blob/master/scripts/home.coffee#L129
This is used, for example, here: https://github.com/MediaCrush/MediaCrush/blob/master/scripts/home.coffee#L217 to run a callback after the worker finishes computing a hash.
Slimit minifies .coffee?
No, it's compiled before it's given to slimit. https://github.com/MediaCrush/MediaCrush/blob/master/app.py#L38
I get a significant improvement by mangling the JS, but there are a couple of special functions that cannot lose their names.